code: def download_file(url, filename):
      max_retries = 20
      cur_retries = 0
  
      header = headers[0]
  
      while cur_retries < max_retries:
          try:
              r = requests.get(url, headers=header, timeout=10)
              with open(filename, "wb") as f:
                  f.write(r.content)
  
              break
          except Exception as e:
              logging.info(" ".join(repr(e).splitlines()))
              logging.error(url)
              cur_retries += 1
  
              # random sample a header from headers
              header = headers[np.random.randint(0, len(headers))]
  
      time.sleep(3 + cur_retries * 2)
  
file_path: lavis/lavis/datasets/download_scripts/download_nocaps.py
imports: import json
  import logging
  import os
  import time
  from multiprocessing import Pool
  import numpy
  import requests
  import tqdm
  from lavis.common.utils import cleanup_dir, get_abs_path, get_cache_path
  from omegaconf import OmegaConf
label_desc: Use image node_id 1 for calling a global function with example usage: download_file(url, filename) without return types