code: def download(
      url, output_file=None, open_file=True, allow_overwrite=False
  ):
      """Download a file from URL.
  
      Args:
          url (str): URL.
          output_file (str, optional): If given, the downloaded file is written to the given path.
          open_file (bool): If True, it returns an opened file stream of the downloaded file.
          allow_overwrite (bool): If True, it overwrites an existing file.
  
      Returns:
          Returns file object if open_file is True, otherwise None.
  
      """
      filename = url.split("/")[-1]
      if output_file is None:
          cache = os.path.join(get_data_home(), filename)
      else:
          cache = output_file
      if os.path.exists(cache) and not allow_overwrite:
          logger.info("> {} already exists.".format(cache))
          logger.info("> If you have any issue when using this file, ")
          logger.info(
              "> manually remove the file and try download again."
          )
      else:
          r = request.urlopen(url)
          try:
              content_length = int(r.headers.get("Content-Length"))
          except:
              content_length = 0
          unit = 1000000
          content = b""
          with tqdm(
              total=content_length,
              desc=filename,
              unit="B",
              unit_scale=True,
              unit_divisor=1024,
          ) as t:
              while True:
                  data = r.read(unit)
                  l = len(data)
                  t.update(l)
                  if l == 0:
                      break
                  content += data
          r.close()
          with open(cache, "wb") as f:
              f.write(content)
      if not open_file:
          return
      return open(cache, "rb")
  
imports: import os
  import urllib.request
  from nnabla.logger import logger
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: download(url, output_file, open_file, allow_overwrite) and returns: open