code: def download_and_extract(root: Path, info: DownloadInfo) -> None:
      """Download and extract a dataset.
  
      Args:
          root (Path): Root directory where the dataset will be stored.
          info (DownloadInfo): Info needed to download the dataset.
      """
      root.mkdir(parents=True, exist_ok=True)
  
      # save the compressed file in the specified root directory, using the same file name as on the server
      if info.filename:
          downloaded_file_path = root / info.filename
      else:
          downloaded_file_path = root / info.url.split("/")[-1]
  
      if downloaded_file_path.exists():
          logger.info(
              "Existing dataset archive found. Skipping download stage."
          )
      else:
          logger.info("Downloading the %s dataset.", info.name)
          with DownloadProgressBar(
              unit="B", unit_scale=True, miniters=1, desc=info.name
          ) as progress_bar:
              urlretrieve(  # nosec - suppress bandit warning (urls are hardcoded)
                  url=f"{info.url}",
                  filename=downloaded_file_path,
                  reporthook=progress_bar.update_to,
              )
          logger.info("Checking the hash of the downloaded file.")
          hash_check(downloaded_file_path, info.hash)
  
      extract(downloaded_file_path, root)
  
imports: from __future__ import annotations
  import hashlib
  import io
  import logging
  import os
  import re
  import tarfile
  from dataclasses import dataclass
  from pathlib import Path
  from tarfile import TarFile, TarInfo
  from typing import Iterable
  from urllib.request import urlretrieve
  from zipfile import ZipFile
  from tqdm import tqdm
label_desc: Use image node_id 5 for calling a global function with example usage: download_and_extract(root, info) without return types