code: def fetch_weights(weights_uri: str, unzip: bool = False) -> str:
      """Provides utilities to download and extract packages
      containing model weights when creating foolbox-zoo compatible
      repositories, if the weights are not part of the repository itself.
  
      Examples
      --------
  
      Download and unzip weights:
  
      >>> from foolbox import zoo
      >>> url = 'https://github.com/MadryLab/mnist_challenge_models/raw/master/secret.zip'  # noqa F501
      >>> weights_path = zoo.fetch_weights(url, unzip=True)
  
      Args:
          weights_uri: The URI to fetch the weights from.
          unzip: Should be `True` if the file to be downloaded is a zipped package.
  
      Returns:
          Local path where the weights have been downloaded and potentially unzipped to.
      """
      assert weights_uri is not None
      hash_digest = sha256_hash(weights_uri)
      local_path = home_directory_path(FOLDER, hash_digest)
      exists_locally = os.path.exists(local_path)
  
      filename = _filename_from_uri(weights_uri)
      file_path = os.path.join(local_path, filename)
  
      if exists_locally:
          logging.info(
              "Weights already stored locally."
          )  # pragma: no cover
      else:
          _download(file_path, weights_uri, local_path)
  
      if unzip:
          file_path = _extract(local_path, filename)
  
      return file_path
  
file_path: foolbox/foolbox/zoo/weights_fetcher.py
imports: import requests
  import shutil
  import zipfile
  import tarfile
  import os
  import logging
  from .common import sha256_hash, home_directory_path
label_desc: Use image node_id 1 for calling a global function with example usage: fetch_weights(weights_uri, unzip) and returns: file_path