def _download_and_extract_archive(
        self,
        url: str,
        file_name: str,
        checksum: Optional[str],
        sub_directory: Optional[str] = None,
        remove_archive: bool = False,
    ) -> Path:
        """
        Utility that downloads and extracts an archive.

        :param url: The download url.
        :param file_name: The name of the archive. The file will be saved
            in the `root` with this name. Always fill this parameter.
            Don't pass a path! Pass a file name only!
        :param checksum: The MD5 hash to use when verifying the downloaded
            archive. Can be None, in which case the check will be skipped.
            It is recommended to always fill this parameter.
        :param sub_directory: The name of the sub directory where to extract the
            archive. Can be None, which means that the archive will be extracted
            in the root. Beware that some archives already have a root directory
            inside of them, in which case it's probably better to use None here.
            Defaults to None.
        :param remove_archive: If True, the archive will be deleted after a
            successful extraction. Defaults to False.
        :return: The path to the extracted archive. If `sub_directory` is None,
            then this will be the `root` path.
        """
        if sub_directory is None:
            extract_root = self.root
        else:
            extract_root = self.root / sub_directory

        self.root.mkdir(parents=True, exist_ok=True)
        try:
            download_and_extract_archive(
                url,
                str(self.root),
                extract_root=str(extract_root),
                filename=file_name,
                md5=checksum,
                remove_finished=remove_archive,
            )
        except BaseException:
            print(
                "Error while downloading the dataset archive. "
                "The partially downloaded archive will be removed."
            )
            attempt_fpath = self.root / file_name
            attempt_fpath.unlink(missing_ok=True)
            raise

        return extract_root

        Utility that downloads and extracts an archive.

        :param url: The download url.
        :param file_name: The name of the archive. The file will be saved
            in the `root` with this name. Always fill this parameter.
            Don't pass a path! Pass a file name only!
        :param checksum: The MD5 hash to use when verifying the downloaded
            archive. Can be None, in which case the check will be skipped.
            It is recommended to always fill this parameter.
        :param sub_directory: The name of the sub directory where to extract the
            archive. Can be None, which means that the archive will be extracted
            in the root. Beware that some archives already have a root directory
            inside of them, in which case it's probably better to use None here.
            Defaults to None.
        :param remove_archive: If True, the archive will be deleted after a
            successful extraction. Defaults to False.
        :return: The path to the extracted archive. If `sub_directory` is None,
            then this will be the `root` path.
        
avalanche/benchmarks/datasets/downloadable_dataset.py