code: def expand_path(path_list, root_path=None):
      
      to_return = set()
      path_list = wrap_list(path_list)
  
      # expand ignore list to include all directories as individual entries
      for p in path_list:
          p = Path(p)
          if p.isdir():
              to_return.add(p)
          head, tail = p.splitpath()
          while head and tail:
              if root_path is not None and head == root_path:
                  break
              to_return.add(head)
              head, tail = head.splitpath()
      return list(to_return)
docs: Given a list of paths, returns a list of all parent paths (including the original paths).
      If provided, ``root_path`` is used as the outermost path when expanding parent paths. If path_list contains
      paths to files, only the directories where those files exist will be returned. This function only returns paths
      to directories.
  
      Example:
  
          expand_path(['/tmp/foo/bar', '/tmp/foo/baz/file.txt' '/tmp/bar'], root_path='/tmp')
  
      This call would return the following:
  
          ['/tmp/foo/bar/',
           '/tmp/foo',
           '/tmp/foo/baz/',
           '/tmp/bar/']
  
      If the ``root_path`` argument were ommitted in the above example,