code: def get_common_ancestor(paths):
      common_ancestor = None
      for path in paths:
          if not path.exists():
              continue
          if common_ancestor is None:
              common_ancestor = path
          else:
              if path.relto(common_ancestor) or path == common_ancestor:
                  continue
              elif common_ancestor.relto(path):
                  common_ancestor = path
              else:
                  shared = path.common(common_ancestor)
                  if shared is not None:
                      common_ancestor = shared
      if common_ancestor is None:
          common_ancestor = py.path.local()
      elif common_ancestor.isfile():
          common_ancestor = common_ancestor.dirpath()
      return common_ancestor
  
file_path: catboost/contrib/python/pytest/py2/_pytest/config/findpaths.py
imports: import os
  import py
  from .exceptions import UsageError
  from _pytest.outcomes import fail
label_desc: Use image node_id 3 for calling a global function with example usage: get_common_ancestor(paths) and returns: common_ancestor