

def _list_subfolders(project, path, cached_folder_lists, recurse=True):
    if (project not in cached_folder_lists):
        cached_folder_lists[project] = dxpy.get_handler(project).describe(input_params={
            'folders': True,
        })['folders']
    if recurse:
        return (f for f in cached_folder_lists[project] if f.startswith(path))
    else:
        return (f for f in cached_folder_lists[project] if (f.startswith(path) and ('/' not in f[(len(path) + 1):])))

dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/cli/download.py _list_subfolders/original