def get_file(
    filename: str, url: Union[str, list[str]], path: str | None = None, extract: bool = False, verbose: bool = False
) -> str:
    """
    Downloads a file from a URL if it not already in the cache. The file at indicated by `url` is downloaded to the
    path `path` (default is ~/.art/data). and given the name `filename`. Files in tar, tar.gz, tar.bz, and zip formats
    can also be extracted. This is a simplified version of the function with the same name in Keras.

    :param filename: Name of the file.
    :param url: Download URL.
    :param path: Folder to store the download. If not specified, `~/.art/data` is used instead.
    :param extract: If true, tries to extract the archive.
    :param verbose: If true, print download progress bar.
    :return: Path to the downloaded file.
    """
    if isinstance(url, str):
        url_list = [url]
    else:
        url_list = url

    if path is None:
        path_ = os.path.expanduser(config.ART_DATA_PATH)
    else:
        path_ = os.path.expanduser(path)
    if not os.access(path_, os.W_OK):
        path_ = os.path.join("/tmp", ".art")

    if not os.path.exists(path_):
        os.makedirs(path_)

    target_path = os.path.join(path_, filename)

    if extract:
        full_path = target_path + ".tar.gz"
    else:
        full_path = target_path

    # Determine if dataset needs downloading
    download = not os.path.exists(target_path)

    if download:
        logger.info("Downloading data from %s", url)
        try:
            for url_i in url_list:
                try:
                    from six.moves.urllib.error import HTTPError, URLError
                    from six.moves.urllib.request import urlretrieve

                    # The following two lines should prevent occasionally occurring
                    # [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:847)
                    import ssl

                    ssl._create_default_https_context = ssl._create_unverified_context

                    if verbose:
                        with tqdm() as t_bar:
                            # pylint: disable=cell-var-from-loop
                            last_block = [0]

                            def progress_bar(blocks: int = 1, block_size: int = 1, total_size: int | None = None):
                                """
                                :param blocks: Number of blocks transferred so far [default: 1].
                                :param block_size: Size of each block (in tqdm units) [default: 1].
                                :param total_size: Total size (in tqdm units). If [default: None] or -1, remains
                                                   unchanged.
                                """
                                if total_size not in (None, -1):
                                    t_bar.total = total_size
                                displayed = t_bar.update((blocks - last_block[0]) * block_size)
                                last_block[0] = blocks
                                return displayed

                            urlretrieve(url_i, full_path, reporthook=progress_bar)
                    else:
                        urlretrieve(url_i, full_path)

                except HTTPError as exception:  # pragma: no cover
                    logger.error(url_i, exception)
                except URLError as exception:  # pragma: no cover
                    logger.error(url_i, exception)
        except (Exception, KeyboardInterrupt):  # pragma: no cover
            if os.path.exists(full_path):
                os.remove(full_path)
            raise

    if extract:
        if not os.path.exists(target_path):
            _extract(full_path, path_)
        return target_path

    return full_path

    Downloads a file from a URL if it not already in the cache. The file at indicated by `url` is downloaded to the
    path `path` (default is ~/.art/data). and given the name `filename`. Files in tar, tar.gz, tar.bz, and zip formats
    can also be extracted. This is a simplified version of the function with the same name in Keras.

    :param filename: Name of the file.
    :param url: Download URL.
    :param path: Folder to store the download. If not specified, `~/.art/data` is used instead.
    :param extract: If true, tries to extract the archive.
    :param verbose: If true, print download progress bar.
    :return: Path to the downloaded file.
    
art/utils.py