diff --git a/lib/backend.py b/lib/backend.py
index 533b88396f48b1f3791577803f4f788451378e0f..a6b676d7469bac3ef235052b05ac6dbb8454c78b 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -962,28 +962,6 @@ def _ErrnoOrStr(err):
   return detail
 
 
-def _OSSearch(name, search_path=None):
-  """Search for OSes with the given name in the search_path.
-
-  Args:
-    name: The name of the OS to look for
-    search_path: List of dirs to search (defaults to constants.OS_SEARCH_PATH)
-
-  Returns:
-    The base_dir the OS resides in
-
-  """
-  if search_path is None:
-    search_path = constants.OS_SEARCH_PATH
-
-  for dir_name in search_path:
-    t_os_dir = os.path.sep.join([dir_name, name])
-    if os.path.isdir(t_os_dir):
-      return t_os_dir
-
-  return None
-
-
 def _OSOndiskVersion(name, os_dir):
   """Compute and return the API version of a given OS.
 
@@ -1073,7 +1051,7 @@ def OSFromDisk(name, base_dir=None):
   """
 
   if base_dir is None:
-    os_dir = _OSSearch(name)
+    os_dir = utils.FindFile(name, constants.OS_SEARCH_PATH, os.path.isdir)
     if os_dir is None:
       raise errors.InvalidOS(name, None, "OS dir not found in search path")
   else:
diff --git a/lib/utils.py b/lib/utils.py
index a1f15d50bd1dcf829e07bd1abfd1ec36c142fbd5..74845402d849b4eb38da2cdc13cca53352492a11 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -1134,3 +1134,27 @@ def Daemonize(logfile, noclose_fds=None):
   os.dup2(0, 1)     # standard output (1)
   os.dup2(0, 2)     # standard error (2)
   return 0
+
+
+def FindFile(name, search_path, test=os.path.exists):
+  """Look for a filesystem object in a given path.
+
+  This is an abstract method to search for filesystem object (files,
+  dirs) under a given search path.
+
+  Args:
+    - name: the name to look for
+    - search_path: list of directory names
+    - test: the test which the full path must satisfy
+      (defaults to os.path.exists)
+
+  Returns:
+    - full path to the item if found
+    - None otherwise
+
+  """
+  for dir_name in search_path:
+    item_name = os.path.sep.join([dir_name, name])
+    if test(item_name):
+      return item_name
+  return None