code: def _get_cached_path(
      manually_downloaded_path: Optional[epath.Path],
      checksum_path: Optional[epath.Path],
      url_path: epath.Path,
      expected_url_info: Optional[checksums.UrlInfo],
  ) -> downloader.DownloadResult:
      """Returns the downloaded path and computed url-info.
  
      If the path is not cached, or that `url_path` does not match checksums,
      the file will be downloaded again.
  
      Path can be cached at three different locations:
  
      Args:
        manually_downloaded_path: Manually downloaded in `dl_manager.manual_dir`
        checksum_path: Cached in the final destination (if checksum known)
        url_path: Cached in the tmp destination (if checksum unknown).
        expected_url_info: Registered checksum (if known)
      """
      # User has manually downloaded the file.
      if manually_downloaded_path and manually_downloaded_path.exists():
          return downloader.DownloadResult(
              manually_downloaded_path, url_info=None
          )  # pytype: disable=wrong-arg-types
  
      # Download has been cached (checksum known)
      elif checksum_path and resource_lib.Resource.exists_locally(
          checksum_path
      ):
          # `path = f(checksum)` was found, so url_info match
          return downloader.DownloadResult(
              checksum_path, url_info=expected_url_info
          )
  
      # Download has been cached (checksum unknown)
      elif resource_lib.Resource.exists_locally(url_path):
          # Info restored from `.INFO` file
          computed_url_info = _read_url_info(url_path)
          # If checksums are now registered but do not match, trigger a new
          # download (e.g. previous file corrupted, checksums updated)
          if (
              expected_url_info
              and computed_url_info != expected_url_info
          ):
              return downloader.DownloadResult(
                  path=None, url_info=None
              )  # pytype: disable=wrong-arg-types
          else:
              return downloader.DownloadResult(
                  url_path, url_info=computed_url_info
              )
  
      # Else file not found (or has bad checksums). (re)download.
      else:
          return downloader.DownloadResult(path=None, url_info=None)
  
imports: from __future__ import annotations
  import concurrent.futures
  import dataclasses
  import functools
  import hashlib
  import typing
  from typing import Any, Dict, Iterator, Optional, Tuple, Union
  import uuid
  from absl import logging
  from etils import epath
  import promise
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.download import checksums
  from tensorflow_datasets.core.download import downloader
  from tensorflow_datasets.core.download import extractor
  from tensorflow_datasets.core.download import kaggle
  from tensorflow_datasets.core.download import resource
  from tensorflow_datasets.core.download import util
  from tensorflow_datasets.core.utils import shard_utils
  from tensorflow_datasets.core.utils import tree_utils
  from tensorflow_datasets.core.utils import type_utils
label_desc: Use image node_id 2 for calling a global function with example usage: _get_cached_path(manually_downloaded_path, checksum_path, url_path, expected_url_info) and returns: downloader, downloader, downloader, downloader, downloader