code: def hash_check(file_path: Path, expected_hash: str) -> None:
      """Raise assert error if hash does not match the calculated hash of the file.
  
      Args:
          file_path (Path): Path to file.
          expected_hash (str): Expected hash of the file.
      """
      with file_path.open("rb") as hash_file:
          assert (
              hashlib.new(
                  name="md5",
                  data=hash_file.read(),
                  usedforsecurity=False,
              ).hexdigest()
              == expected_hash
          ), f"Downloaded file {file_path} does not match the required hash."
  
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 3 for calling a global function with example usage: hash_check(file_path, expected_hash) without return types