code: def _walk_to_root(path, break_at=None):
      
      if not os.path.exists(path):  # pragma: no cover
          raise IOError("Starting path not found")
  
      if os.path.isfile(path):  # pragma: no cover
          path = os.path.dirname(path)
  
      last_dir = None
      current_dir = os.path.abspath(path)
      paths = []
      while last_dir != current_dir:
          paths.append(current_dir)
          paths.append(os.path.join(current_dir, "config"))
          if break_at and current_dir == os.path.abspath(break_at):  # noqa
              logger.debug("Reached the %s directory, breaking.", break_at)
              break
          parent_dir = os.path.abspath(os.path.join(current_dir, os.path.pardir))
          last_dir, current_dir = current_dir, parent_dir
      return paths
docs: Directories starting from the given directory up to the root or break_at