code: def download_models(
      opt,
      fnames,
      model_folder,
      version="v1.0",
      path="aws",
      use_model_type=False,
      flatten_tar=False,
  ):
      """
      Download models into the ParlAI model zoo from a url.
  
      :param fnames: list of filenames to download
      :param model_folder: models will be downloaded into models/model_folder/model_type
      :param path: url for downloading models; defaults to downloading from AWS
      :param use_model_type: whether models are categorized by type in AWS
      """
      model_type = opt.get("model_type", None)
      if model_type is not None:
          dpath = os.path.join(
              opt["datapath"], "models", model_folder, model_type
          )
      else:
          dpath = os.path.join(opt["datapath"], "models", model_folder)
  
      if not built(dpath, version):
          for fname in fnames:
              logging.info(f"building data: {dpath}/{fname}")
          if built(dpath):
              # An older version exists, so remove these outdated files.
              remove_dir(dpath)
          make_dir(dpath)
  
          # Download the data.
          for fname in fnames:
              if path == "aws":
                  url = "http://parl.ai/downloads/_models/"
                  url += model_folder + "/"
                  if use_model_type:
                      url += model_type + "/"
                  url += fname
              else:
                  url = path + "/" + fname
              download(url, dpath, fname)
              if ".tgz" in fname or ".gz" in fname or ".zip" in fname:
                  untar(dpath, fname, flatten_tar=flatten_tar)
          # Mark the data as built.
          mark_done(dpath, version)
  
imports: import importlib
  import json
  import time
  import datetime
  import os
  import requests
  import shutil
  import hashlib
  import tqdm
  import gzip
  import math
  import contextlib
  import parlai.utils.logging
  from parlai.utils.io import PathManager
label_desc: Use image node_id 13 for calling a global function with example usage: download_models(opt, fnames, model_folder, version, path, use_model_type, flatten_tar) without return types