def list_files(roots, recurse=False):
    for root in roots:
        root = (root if root[-1] != '\n' else root[:-1])
        root = os.path.normpath(root)
        if os.path.isfile(root):
            yield root
        else:
            for path, unused, files in os.walk(root):
                for f in files:
                    yield os.path.join(path, f)
                if recurse == False:
                    break
Return the files one at a time.  Roots could be a fileobj or a list.
dataset/ETHPy150Open openpreserve/fido/fido/fido.py/list_files