code: def download_url(
      url: str,
      filepath: PathLike = "",
      hash_val: str | None = None,
      hash_type: str = "md5",
      progress: bool = True,
      **gdown_kwargs: Any,
  ) -> None:
      """
      Download file from specified URL link, support process bar and hash check.
  
      Args:
          url: source URL link to download file.
          filepath: target filepath to save the downloaded file (including the filename).
              If undefined, `os.path.basename(url)` will be used.
          hash_val: expected hash value to validate the downloaded file.
              if None, skip hash validation.
          hash_type: 'md5' or 'sha1', defaults to 'md5'.
          progress: whether to display a progress bar.
          gdown_kwargs: other args for `gdown` except for the `url`, `output` and `quiet`.
              these args will only be used if download from google drive.
              details of the args of it:
              https://github.com/wkentaro/gdown/blob/main/gdown/download.py
  
      Raises:
          RuntimeError: When the hash validation of the ``filepath`` existing file fails.
          RuntimeError: When a network issue or denied permission prevents the
              file download from ``url`` to ``filepath``.
          URLError: See urllib.request.urlretrieve.
          HTTPError: See urllib.request.urlretrieve.
          ContentTooShortError: See urllib.request.urlretrieve.
          IOError: See urllib.request.urlretrieve.
          RuntimeError: When the hash validation of the ``url`` downloaded file fails.
  
      """
      if not filepath:
          filepath = Path(".", _basename(url)).resolve()
          logger.info(f"Default downloading to '{filepath}'")
      filepath = Path(filepath)
      if filepath.exists():
          if not check_hash(filepath, hash_val, hash_type):
              raise RuntimeError(
                  f"{hash_type} check of existing file failed: filepath={filepath}, expected {hash_type}={hash_val}."
              )
          logger.info(f"File exists: {filepath}, skipped downloading.")
          return
      try:
          with tempfile.TemporaryDirectory() as tmp_dir:
              tmp_name = Path(tmp_dir, _basename(filepath))
              if urlparse(url).netloc == "drive.google.com":
                  if not has_gdown:
                      raise RuntimeError(
                          "To download files from Google Drive, please install the gdown dependency."
                      )
                  if "fuzzy" not in gdown_kwargs:
                      gdown_kwargs[
                          "fuzzy"
                      ] = True  # default to true for flexible url
                  gdown.download(
                      url,
                      f"{tmp_name}",
                      quiet=not progress,
                      **gdown_kwargs,
                  )
              elif urlparse(url).netloc == "cloud-api.yandex.net":
                  with urlopen(url) as response:
                      code = response.getcode()
                      if code == 200:
                          download_url = json.load(response)["href"]
                          _download_with_progress(
                              download_url, tmp_name, progress=progress
                          )
                      else:
                          raise RuntimeError(
                              f"Download of file from {download_url}, received from {url} "
                              + f" to {filepath} failed due to network issue or denied permission."
                          )
              else:
                  _download_with_progress(
                      url, tmp_name, progress=progress
                  )
              if not tmp_name.exists():
                  raise RuntimeError(
                      f"Download of file from {url} to {filepath} failed due to network issue or denied permission."
                  )
              file_dir = filepath.parent
              if file_dir:
                  os.makedirs(file_dir, exist_ok=True)
              shutil.move(
                  f"{tmp_name}", f"{filepath}"
              )  # copy the downloaded to a user-specified cache.
      except (
          PermissionError,
          NotADirectoryError,
      ):  # project-monai/monai issue #3613 #3757 for windows
          pass
      logger.info(f"Downloaded: {filepath}")
      if not check_hash(filepath, hash_val, hash_type):
          raise RuntimeError(
              f"{hash_type} check of downloaded file failed: URL={url}, "
              f"filepath={filepath}, expected {hash_type}={hash_val}."
          )
  
imports: from __future__ import annotations
  import hashlib
  import json
  import logging
  import os
  import shutil
  import sys
  import tarfile
  import tempfile
  import warnings
  import zipfile
  from pathlib import Path
  from typing import TYPE_CHECKING, Any
  from urllib.error import ContentTooShortError, HTTPError, URLError
  from urllib.parse import urlparse
  from urllib.request import urlopen, urlretrieve
  from monai.config.type_definitions import PathLike
  from monai.utils import look_up_option, min_version, optional_import
label_desc: Use image node_id 5 for calling a global function with example usage: download_url(url, filepath, hash_val, hash_type, progress) without return types