code: def find_vcs_root(path, dirs=(".git",)):
      
      prev, path = None, os.path.abspath(path)
      while prev != path:
          if any(os.path.exists(os.path.join(path, d)) for d in dirs):
              return path
          prev, path = path, os.path.abspath(os.path.join(path, os.pardir))
      return None
docs: Searches up from a given path to find the project root.