def _download_file(self, fname):
        """
        Download a file from the remote data storage to the local storage.

        Used by :meth:`~pooch.Pooch.fetch` to do the actual downloading.

        Parameters
        ----------
        fname : str
            The file name (relative to the *base_url* of the remote data storage) to
            fetch from the local storage.

        Raises
        ------
        ValueError
            If the hash of the downloaded file doesn't match the hash in the registry.

        """
        destination = self.abspath / fname
        source = self.get_url(fname)
        # Stream the file to a temporary so that we can safely check its hash before
        # overwriting the original
        fout = tempfile.NamedTemporaryFile(delete=False, dir=str(self.abspath))
        try:
            with fout:
                response = requests.get(source, stream=True)
                response.raise_for_status()
                for chunk in response.iter_content(chunk_size=1024):
                    if chunk:
                        fout.write(chunk)
            tmphash = file_hash(fout.name)
            if tmphash != self.registry[fname]:
                raise ValueError(
                    "Hash of downloaded file '{}' doesn't match the entry in the registry:"
                    " Expected '{}' and got '{}'.".format(
                        fout.name, self.registry[fname], tmphash
                    )
                )
            # Make sure the parent directory exists in case the file is in a subdirectory.
            # Otherwise, move will cause an error.
            if not os.path.exists(str(destination.parent)):
                os.makedirs(str(destination.parent))
            shutil.move(fout.name, str(destination))
        except Exception:
            os.remove(fout.name)
            raise
Download a file from the remote data storage to the local storage.

        Used by :meth:`~pooch.Pooch.fetch` to do the actual downloading.

        Parameters
        ----------
        fname : str
            The file name (relative to the *base_url* of the remote data storage) to
            fetch from the local storage.

        Raises
        ------
        ValueError
            If the hash of the downloaded file doesn't match the hash in the registry.