code: def download_url(
      url: str,
      root: str,
      filename: Optional[str] = None,
      md5: Optional[str] = None,
  ) -> None:
      """Download a file from a url and place it in root.
  
      Args:
          url (str): URL to download file from
          root (str): Directory to place downloaded file in
          filename (str, optional): Name to save the file under.
                                    If None, use the basename of the URL.
          md5 (str, optional): MD5 checksum of the download. If None, do not check
      """
      root = os.path.expanduser(root)
      if not filename:
          filename = os.path.basename(url)
      fpath = os.path.join(root, filename)
  
      makedir(root)
  
      # check if file is already present locally
      if check_integrity(fpath, md5):
          print("Using downloaded and verified file: " + fpath)
          return
  
      # expand redirect chain if needed
      url = get_redirected_url(url)
  
      # check if file is located on Google Drive
      file_id = _get_google_drive_file_id(url)
      if file_id is not None:
          return download_file_from_google_drive(
              file_id, root, filename, md5
          )
  
      # download the file
      try:
          print("Downloading " + url + " to " + fpath)
          _urlretrieve(url, fpath)
      except (urllib.error.URLError, IOError) as e:  # type: ignore[attr-defined]
          if url[:5] == "https":
              url = url.replace("https:", "http:")
              print(
                  "Failed download. Trying https -> http instead."
                  " Downloading " + url + " to " + fpath
              )
              _urlretrieve(url, fpath)
          else:
              raise e
  
      # check integrity of downloaded file
      if not check_integrity(fpath, md5):
          raise RuntimeError("File not found or corrupted.")
  
file_path: vissl/vissl/utils/download.py
imports: import io
  import os
  import re
  import urllib
  import urllib.error
  import urllib.request
  from typing import Optional
  from urllib.parse import urlparse
  from torch.utils.model_zoo import tqdm
  from torchvision.datasets.utils import check_integrity, download_file_from_google_drive, extract_archive
  from vissl.utils.io import makedir
label_desc: Use image node_id 6 for calling a global function with example usage: download_url(url, root, filename, md5) and returns: download_file_from_google_drive