code: def download_and_extract(
      url: str,
      filepath: PathLike = "",
      output_dir: PathLike = ".",
      hash_val: str | None = None,
      hash_type: str = "md5",
      file_type: str = "",
      has_base: bool = True,
      progress: bool = True,
  ) -> None:
      """
      Download file from URL and extract it to the output directory.
  
      Args:
          url: source URL link to download file.
          filepath: the file path of the downloaded compressed file.
              use this option to keep the directly downloaded compressed file, to avoid further repeated downloads.
          output_dir: target directory to save extracted files.
              default is the current directory.
          hash_val: expected hash value to validate the downloaded file.
              if None, skip hash validation.
          hash_type: 'md5' or 'sha1', defaults to 'md5'.
          file_type: string of file type for decompressing. Leave it empty to infer the type from url's base file name.
          has_base: whether the extracted files have a base folder. This flag is used when checking if the existing
              folder is a result of `extractall`, if it is, the extraction is skipped. For example, if A.zip is unzipped
              to folder structure `A/*.png`, this flag should be True; if B.zip is unzipped to `*.png`, this flag should
              be False.
          progress: whether to display progress bar.
      """
      with tempfile.TemporaryDirectory() as tmp_dir:
          filename = filepath or Path(tmp_dir, _basename(url)).resolve()
          download_url(
              url=url,
              filepath=filename,
              hash_val=hash_val,
              hash_type=hash_type,
              progress=progress,
          )
          extractall(
              filepath=filename,
              output_dir=output_dir,
              file_type=file_type,
              has_base=has_base,
          )
  
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 7 for calling a global function with example usage: download_and_extract(url, filepath, output_dir, hash_val, hash_type, file_type, has_base, progress) without return types