code: def main(_):
      logging.info("Load all UrlInfo.")
      path_to_url_infos = _collect_path_to_url_infos()
  
      # Remove duplicate urls (merge all Dict[Url, UrlInfo] together)
      all_url_infos = dict(
          itertools.chain.from_iterable(
              d.items() for d in path_to_url_infos.values()
          )
      )
  
      logging.info("Start fetching filenames.")
      with futures.ThreadPoolExecutor(max_workers=100) as executor:
          # Query all filenames in parallel
          iter_all_url_infos = tqdm.tqdm(
              all_url_infos.items(), desc="Urls sent"
          )
          received_tqdm = tqdm.tqdm(
              desc="Filenames received", total=len(all_url_infos)
          )
          urls_to_filename = {
              url: executor.submit(
                  _request_filename, url, url_info, received_tqdm
              )
              for url, url_info in iter_all_url_infos
          }
          # Update and save the new UrlInfo
          for path, url_infos in tqdm.tqdm(
              path_to_url_infos.items(), desc="Saving filenames"
          ):
              # Update the UrlInfo with the new filenames
              url_infos = {
                  url: _update_url_info(
                      url, url_info, urls_to_filename[url].result()
                  )
                  for url, url_info in url_infos.items()
              }
              checksums.save_url_infos(path, url_infos)
      received_tqdm.close()
      tqdm.tqdm.write("Url infos updated.")
  
file_path: datasets/tensorflow_datasets/scripts/cleanup/url_filename_recorder.py
imports: from concurrent import futures
  import dataclasses
  import itertools
  import typing
  from typing import Dict, NewType, Optional
  import urllib
  from absl import app
  from absl import logging
  import requests
  import tensorflow_datasets
  from tensorflow_datasets.core.download import checksums
  import tqdm
label_desc: Use image node_id 4 for calling a global function with example usage: main(_) without return types