code: def cached_path(url_or_filename: str, cache_dir: Path) -> Path:
      """
      Given something that might be a URL (or might be a local path),
      determine which. If it's a URL, download the file and cache it, and
      return the path to the cached file. If it's already a local path,
      make sure the file exists and then return the path.
      """
      dataset_cache = Path(UNDERTHESEA_FOLDER) / cache_dir
  
      parsed = urlparse(url_or_filename)
  
      if parsed.scheme in ("http", "https"):
          # URL, so get it from the cache (downloading if necessary)
          return get_from_cache(url_or_filename, dataset_cache)
      elif parsed.scheme == "" and Path(url_or_filename).exists():
          # File, and it exists.
          return Path(url_or_filename)
      elif parsed.scheme == "":
          # File, but it doesn't exist.
          raise FileNotFoundError(
              "file {} not found".format(url_or_filename)
          )
      else:
          # Something unknown
          raise ValueError(
              "unable to parse {} as a URL or as a local path".format(
                  url_or_filename
              )
          )
  
file_path: underthesea/underthesea/file_utils.py
imports: import mmap
  from os.path import join
  from pathlib import Path
  import os
  import shutil
  import tempfile
  import re
  from urllib.parse import urlparse
  from tqdm import tqdm
  import requests
  from underthesea.utils import logger
label_desc: Use image node_id 1 for calling a global function with example usage: cached_path(url_or_filename, cache_dir) and returns: get_from_cache, Path