code: def cached_path(
      url_or_filepath: str,
      extract_compressed_file: bool = False,
      local_files_only: bool = False,
      progress_indicator: Optional[tqdm.tqdm] = None,
  ) -> str:
      """Get the path to the locally cached resource."""
      if is_remote(url_or_filepath):
          logging.info("%s is remote", url_or_filepath)
          output_path = _get_from_cache(
              url_or_filepath,
              local_files_only=local_files_only,
              progress_indicator=progress_indicator,
          )
      elif os.path.exists(url_or_filepath):
          logging.info("%s is local", url_or_filepath)
          output_path = url_or_filepath
      elif not urllib_parse.urlparse(url_or_filepath).scheme:
          raise EnvironmentError(f"File not found: {url_or_filepath}")
      else:
          raise ValueError(
              f"Unable to parse as URL or local path: {url_or_filepath}"
          )
  
      if not extract_compressed_file:
          return output_path
      else:
          return _get_extacted_dir(output_path)
  
imports: from collections.abc import Mapping
  import functools
  import hashlib
  import os
  import shutil
  import sys
  import tarfile
  import tempfile
  from typing import BinaryIO, Optional
  from urllib import parse
  import zipfile
  from absl import logging
  import filelock
  import requests
  import tqdm
label_desc: Use image node_id 6 for calling a global function with example usage: cached_path(url_or_filepath, extract_compressed_file, local_files_only, progress_indicator) and returns: output_path, _get_extacted_dir