code: def set_cache_dir(directory):
      
      global cache_dir
  
      if directory is None:
          cache_dir = None
          return
  
      if not os.path.exists(directory):
          os.makedirs(directory)
      if not os.path.isdir(directory):
          raise ValueError("not a directory")
      cache_dir = directory
docs: Set the directory to cache JSON responses from most API endpoints.