def expand(path):
    # Base case
    if path in ['', os.path.sep]:
        return [path]
    ret = PrependList()
    directory, filename = os.path.split(path)
    while directory and directory != os.path.sep:
        ret.prepend(filename)
        directory, filename = os.path.split(directory)
    ret.prepend(filename)
    # Handle absolute vs relative paths
    ret.prepend(directory if directory == os.path.sep else '')
    return ret
'/foo/bar/biz' => ('/', 'foo', 'bar', 'biz')
dataset/ETHPy150Open fabric/fabric/tests/server.py/expand