human
I wrote the below code

    def _recursive_list(subpath):
        return sorted(os.walk(subpath, followlinks=follow_links), key=(lambda tpl: tpl[0]))
    classes = []
    filenames = []
    subdir = os.path.basename(directory)
    basedir = os.path.dirname(directory)
    for (root, _, files) in _recursive_list(directory):
        for fname in files:
            is_valid = False
            for extension in white_list_formats:
                if fname.lower().endswith(('.' + extension)):
                    is_valid = True
                    break
            if is_valid:
                classes.append(class_indices[subdir])
                absolute_path = os.path.join(root, fname)
                filenames.append(os.path.relpath(absolute_path, basedir))
    return (classes, filenames)

What's a good function header?
 ... Here's a good function header?
assistant
#Here's a good function header.

def _list_valid_filenames_in_directory(directory, white_list_formats, class_indices, follow_links):