code: def recursepath(path, reverse=False):
      # type: (Text, bool) -> List[Text]
      
      if path in "/":
          return ["/"]
  
      path = abspath(normpath(path)) + "/"
  
      paths = ["/"]
      find = path.find
      append = paths.append
      pos = 1
      len_path = len(path)
  
      while pos < len_path:
          pos = find("/", pos)
          append(path[:pos])
          pos += 1
  
      if reverse:
          return paths[::-1]
      return paths
docs: Get intermediate paths from the root to the given path.
  
      Arguments:
          path (str): A PyFilesystem path
          reverse (bool): Reverses the order of the paths
              (default `False`).
  
      Returns:
          list: A list of paths.
  
      Example:
          >>> recursepath('a/b/c')
          ['/', '/a', '/a/b', '/a/b/c']