code: def _download_or_reuse_cache(
      name: naming.DatasetName,
      package_index: _PackageIndex,
  ) -> _InstalledPackage:
      """Downloads the dataset generation source code.
  
      Search the dataset in the cache, or download it from the package index
      otherwise.
  
      Args:
        name: Dataset name to load.
        package_index: Index of all community datasets. Might be updated.
  
      Returns:
        The installed dataset information.
  
      Raises:
        DatasetNotFoundError: If the dataset can't be loaded.
      """
      # Dataset can be:
      # * Installed locally (in the cache) -> reuse
      # * Not installed but present in the package index -> install
      # * Not present in the package index -> raise error
  
      # Check if the file is already downloaded/cached
      # TODO(tfds): To force a download even if file already present, we
      # should add a `ignore_cache=True` option in `tfds.load`. Or should always
      # try to download the file ?
      last_installed_version = _get_last_installed_version(name)
      if last_installed_version:
          return last_installed_version
  
      # If file isn't cached yet, we need to download it.
      # First need to find it's location.
      if name not in package_index:
          # If not, we need to update the package index cache
          package_index.refresh()
      # If the dataset is present in the package index cache, use this
      package = package_index.get(name)
      if not package:
          # If still not found, raise an DatasetNotFoundError
          raise registered.DatasetNotFoundError(
              f"Could not find dataset {name}: Dataset not found among the "
              f"{len(package_index)} datasets of the community index."
          )
  
      # If package was found, download it.
      installed_package = _download_and_cache(package)
      return installed_package
  
imports: import collections
  import dataclasses
  import datetime
  import functools
  import hashlib
  import json
  import tempfile
  from typing import Any, Iterator, List, Optional, Type
  from absl import logging
  from etils import epath
  from tensorflow_datasets.core import dataset_builder
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import registered
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.community import cache
  from tensorflow_datasets.core.community import dataset_sources
  from tensorflow_datasets.core.community import load
  from tensorflow_datasets.core.community import register_base
  from tensorflow_datasets.core.download import checksums
  from tensorflow_datasets.core.utils import gcs_utils
label_desc: Use image node_id 3 for calling a global function with example usage: _download_or_reuse_cache(name, package_index) and returns: installed_package, last_installed_version