code: def fetch_from_web_or_disk(url, key, cache=True, dtype=DTYPE):
      """Fetch a dataset from the web, and save it in the pmdarima cache"""
      if key in _cache:
          return _cache[key]
  
      disk_cache_path = get_data_cache_path()
  
      # don't ask, just tell. avoid race conditions
      os.makedirs(disk_cache_path, exist_ok=True)
  
      # See if it's already there
      data_path = join(disk_cache_path, key + ".csv.gz")
      if os.path.exists(data_path):
          rslt = np.loadtxt(data_path).ravel()
  
      else:
          r = None
          rslt = None
          try:
              r = http.request("GET", url)
              # rank 1 because it's a time series
              rslt = np.asarray(
                  r.data.decode("utf-8").split("\n"), dtype=dtype
              )
  
          finally:
              if rslt is not None:
                  try:
                      r.release_conn()
                  except Exception:
                      pass
  
          # if we got here, rslt is good. We need to save it to disk
          np.savetxt(fname=data_path, X=rslt)
  
      # If we get here, we have rslt.
      if cache:
          _cache[key] = rslt
  
      return rslt
  
file_path: pmdarima/pmdarima/datasets/_base.py
imports: import os
  from os.path import abspath, dirname, join, expanduser
  import numpy
  import pandas
  import urllib3
  import tarfile
  from ..compat.numpy import DTYPE
label_desc: Use image node_id 3 for calling a global function with example usage: fetch_from_web_or_disk(url, key, cache, dtype) and returns: rslt, _cache