code: def cached_download(url):
      """Downloads a file and caches it.
  
      It downloads a file from the URL if there is no corresponding cache. After
      the download, this function stores a cache to the directory under the
      dataset root (see :func:`set_dataset_root`). If there is already a cache
      for the given URL, it just returns the path to the cache without
      downloading the same file.
  
      .. note::
          This function raises :class:`OSError` when it fails to create
          the cache directory. In older version, it raised :class:`RuntimeError`.
  
      Args:
          url (str): URL to download from.
  
      Returns:
          str: Path to the downloaded file.
  
      """
      cache_root = os.path.join(_dataset_root, "_dl_cache")
      try:
          os.makedirs(cache_root)
      except OSError:
          if not os.path.isdir(cache_root):
              raise
  
      lock_path = os.path.join(cache_root, "_dl_lock")
      urlhash = hashlib.md5(url.encode("utf-8")).hexdigest()
      cache_path = os.path.join(cache_root, urlhash)
  
      with filelock.FileLock(lock_path):
          if os.path.exists(cache_path):
              return cache_path
  
      with utils.tempdir(dir=cache_root) as temp_root:
          temp_path = os.path.join(temp_root, "dl")
          sys.stderr.write("Downloading from {}...\n".format(url))
          sys.stderr.flush()
          request.urlretrieve(url, temp_path)
          with filelock.FileLock(lock_path):
              shutil.move(temp_path, cache_path)
  
      return cache_path
  
file_path: chainer/chainer/dataset/download.py
imports: import hashlib
  import os
  import shutil
  import sys
  import filelock
  from six.moves.urllib import request
  from chainer import utils
label_desc: Use image node_id 4 for calling a global function with example usage: cached_download(url) and returns: cache_path, cache_path