code: def rewrite_dir(fake_dir):
      """Process the whole directory which contains the compressed files.
  
      Args:
        fake_dir: path of the directory which contains all compression files
      """
      img_ext_list = [".jpg", ".jpeg", ".png"]
  
      for root_dir, _, files in os.walk(fake_dir):
          if any(skip_ds in root_dir for skip_ds in SKIP_DATASETS):
              print(f"Skipping {root_dir}")
              continue
          print(f"Processing {root_dir}")
          for file in files:
              path = os.path.join(root_dir, file)
              file_ext = os.path.splitext(file)[-1].lower()
              if file_ext in img_ext_list:
                  rewrite_image(path)
              elif file_ext == ".npz":  # Filter `.npz` files
                  continue
              elif zipfile.is_zipfile(path):
                  rewrite_zip(root_dir, path)
              elif tarfile.is_tarfile(path):
                  rewrite_tar(root_dir, path)
  
file_path: datasets/tensorflow_datasets/scripts/replace_fake_images.py
imports: import hashlib
  import os
  import tarfile
  import tempfile
  import zipfile
  import zlib
  import absl.app
  import absl.flags
  import numpy
  import PIL.Image
label_desc: Use image node_id 4 for calling a global function with example usage: rewrite_dir(fake_dir) without return types