code: def _download_file(self, url, filename, compress=False, timeout=30):
          
          if not lineage.create_dir(self._resources_dir):
              return None
  
          if compress and filename[-3:] != ".gz":
              filename += ".gz"
  
          destination = os.path.join(self._resources_dir, filename)
  
          if not os.path.exists(destination):
              try:
                  if compress:
                      open_func = gzip.open
                  else:
                      open_func = open
  
                  # get file if it hasn't already been downloaded
                  # http://stackoverflow.com/a/7244263
                  with urllib.request.urlopen(
                      url, timeout=timeout
                  ) as response, open_func(destination, "wb") as f:
                      self._print_download_msg(destination)
                      data = response.read()  # a `bytes` object
                      f.write(data)
              except urllib.error.URLError as err:
                  print(err)
                  destination = None
                  # try HTTP if an FTP error occurred
                  if "ftp://" in url:
                      destination = self._download_file(
                          url.replace("ftp://", "http://"),
                          filename,
                          compress=compress,
                          timeout=timeout,
                      )
              except Exception as err:
                  print(err)
                  return None
  
          return destination
docs: Download a file to the resources folder.
  
          Download data from `url`, save as `filename`, and optionally compress with gzip.
  
          Parameters
          ----------
          url : str
              URL to download data from
          filename : str
              name of file to save; if compress, ensure '.gz' is appended
          compress : bool
              compress with gzip
          timeout : int
              seconds for timeout of download request
  
          Returns
          -------
          str
              path to downloaded file, None if error