code: def files_generator(path, recursive):
      
      if recursive:
          for (path, _, files) in os.walk(path):
              for file in files:
                  if not file.endswith(BATCH_EXTENSION):
                      yield (path, file)
      else:
          for file in os.listdir(path):
              if (os.path.isfile(os.path.join(path, file)) and
                      not file.endswith(BATCH_EXTENSION)):
                  yield (path, file)
docs: Yield files found in a given path.
  
      Walk over a given path finding and yielding all
      files found on it. This can be done only on the root
      directory or recursively.
  
      Args:
          path: Path to the directory.
          recursive: Whether to find files recursively or not.
  
      Yields:
          A tuple for each file in the given path containing
          the path and the name of the file.