code: def _fetch(data_filename):
      """Fetch a given data file from either the local cache or the repository.
  
      This function provides the path location of the data file given
      its name in the scikit-image repository. If a data file is not included in the
      distribution and pooch is available, it is downloaded and cached.
  
      Parameters
      ----------
      data_filename : str
          Name of the file in the scikit-image repository. e.g.
          'restoration/tess/camera_rl.npy'.
  
      Returns
      -------
      file_path : str
          Path of the local file.
  
      Raises
      ------
      KeyError:
          If the filename is not known to the scikit-image distribution.
  
      ModuleNotFoundError:
          If the filename is known to the scikit-image distribution but pooch
          is not installed.
  
      ConnectionError:
          If scikit-image is unable to connect to the internet but the
          dataset has not been downloaded yet.
      """
      expected_hash = registry[data_filename]
      if _image_fetcher is None:
          cache_dir = osp.dirname(data_dir)
      else:
          cache_dir = str(_image_fetcher.abspath)
  
      # Case 1: the file is already cached in `data_cache_dir`
      cached_file_path = osp.join(cache_dir, data_filename)
      if _has_hash(cached_file_path, expected_hash):
          # Nothing to be done, file is where it is expected to be
          return cached_file_path
  
      # Case 2: file is present in `legacy_data_dir`
      legacy_file_path = osp.join(_DISTRIBUTION_DIR, data_filename)
      if _has_hash(legacy_file_path, expected_hash):
          return legacy_file_path
  
      # Case 3: file is not present locally
      if _image_fetcher is None:
          _skip_pytest_case_requiring_pooch(data_filename)
          raise ModuleNotFoundError(
              "The requested file is part of the scikit-image distribution, "
              "but requires the installation of an optional dependency, pooch. "
              "To install pooch, use your preferred python package manager. "
              "Follow installation instruction found at "
              "https://scikit-image.org/docs/stable/user_guide/install.html"
          )
      # Download the data with pooch which caches it automatically
      _ensure_cache_dir(target_dir=cache_dir)
      try:
          cached_file_path = _image_fetcher.fetch(data_filename)
          return cached_file_path
      except ConnectionError as err:
          _skip_pytest_case_requiring_pooch(data_filename)
          # If we decide in the future to suppress the underlying 'requests'
          # error, change this to `raise ... from None`. See PEP 3134.
          raise ConnectionError(
              "Tried to download a scikit-image dataset, but no internet "
              "connection is available. To avoid this message in the "
              "future, try `skimage.data.download_all()` when you are "
              "connected to the internet."
          ) from err
  
imports: import numpy
  import shutil
  from ..util.dtype import img_as_bool
  from ._registry import registry, registry_urls
  from ..None import __version__
  import os.path
  import os
label_desc: Use image node_id 5 for calling a global function with example usage: _fetch(data_filename) and returns: cached_file_path, legacy_file_path, cached_file_path