code: def read_file_cached(blobpath: str) -> bytes:
      user_specified_cache = True
      if "TIKTOKEN_CACHE_DIR" in os.environ:
          cache_dir = os.environ["TIKTOKEN_CACHE_DIR"]
      elif "DATA_GYM_CACHE_DIR" in os.environ:
          cache_dir = os.environ["DATA_GYM_CACHE_DIR"]
      else:
          cache_dir = os.path.join(
              tempfile.gettempdir(), "data-gym-cache"
          )
          user_specified_cache = False
  
      if cache_dir == "":
          # disable caching
          return read_file(blobpath)
  
      cache_key = hashlib.sha1(blobpath.encode()).hexdigest()
  
      cache_path = os.path.join(cache_dir, cache_key)
      if os.path.exists(cache_path):
          with open(cache_path, "rb") as f:
              return f.read()
  
      contents = read_file(blobpath)
  
      try:
          os.makedirs(cache_dir, exist_ok=True)
          tmp_filename = cache_path + "." + str(uuid.uuid4()) + ".tmp"
          with open(tmp_filename, "wb") as f:
              f.write(contents)
          os.rename(tmp_filename, cache_path)
      except OSError:
          # don't raise if we can't write to the default cache, e.g. issue #75
          if user_specified_cache:
              raise
  
      return contents
  
file_path: tiktoken/tiktoken/load.py
imports: from __future__ import annotations
  import base64
  import hashlib
  import json
  import os
  import tempfile
  import uuid
  import requests
label_desc: Use image node_id 2 for calling a global function with example usage: read_file_cached(blobpath) and returns: contents, read_file, f