code: def iter_valid_files(directory, follow_links, formats):
      if not follow_links:
          walk = tf.io.gfile.walk(directory)
      else:
          walk = os.walk(directory, followlinks=follow_links)
      for root, _, files in sorted(walk, key=lambda x: x[0]):
          for fname in sorted(files):
              if fname.lower().endswith(formats):
                  yield root, fname
  
imports: import os
  import random
  import time
  import warnings
  from multiprocessing.pool import ThreadPool
  import numpy
  from keras.api_export import keras_export
  from keras.utils import io_utils
  from keras.utils.module_utils import tensorflow
label_desc: Use image node_id 13 for calling a global function with example usage: iter_valid_files(directory, follow_links, formats) without return types