code: def _list_valid_filenames_in_directory(
      directory, white_list_formats, split, class_indices, follow_links
  ):
      """Lists paths of files in `subdir` with extensions in `white_list_formats`.
  
      # Arguments
          directory: absolute path to a directory containing the files to list.
              The directory name is used as class label
              and must be a key of `class_indices`.
          white_list_formats: set of strings containing allowed extensions for
              the files to be counted.
          split: tuple of floats (e.g. `(0.2, 0.6)`) to only take into
              account a certain fraction of files in each directory.
              E.g.: `segment=(0.6, 1.0)` would only account for last 40 percent
              of images in each directory.
          class_indices: dictionary mapping a class name to its index.
          follow_links: boolean, follow symbolic links to subdirectories.
  
      # Returns
           classes: a list of class indices
           filenames: the path of valid files in `directory`, relative from
               `directory`'s parent (e.g., if `directory` is "dataset/class1",
              the filenames will be
              `["class1/file1.jpg", "class1/file2.jpg", ...]`).
      """
      dirname = os.path.basename(directory)
      if split:
          all_files = list(
              _iter_valid_files(
                  directory, white_list_formats, follow_links
              )
          )
          num_files = len(all_files)
          start, stop = int(split[0] * num_files), int(
              split[1] * num_files
          )
          valid_files = all_files[start:stop]
      else:
          valid_files = _iter_valid_files(
              directory, white_list_formats, follow_links
          )
      classes = []
      filenames = []
      for root, fname in valid_files:
          classes.append(class_indices[dirname])
          absolute_path = os.path.join(root, fname)
          relative_path = os.path.join(
              dirname, os.path.relpath(absolute_path, directory)
          )
          filenames.append(relative_path)
  
      return classes, filenames
  
file_path: keras-preprocessing/keras_preprocessing/image/utils.py
imports: import io
  import os
  import warnings
  from pathlib import Path
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: _list_valid_filenames_in_directory(directory, white_list_formats, split, class_indices, follow_links) and returns: classes,  filenames