code: def get_cache_dir() -> Path:
      """Get the cache directory used by black.
  
      Users can customize this directory on all systems using `BLACK_CACHE_DIR`
      environment variable. By default, the cache directory is the user cache directory
      under the black application.
  
      This result is immediately set to a constant `black.cache.CACHE_DIR` as to avoid
      repeated calls.
      """
      # NOTE: Function mostly exists as a clean way to test getting the cache directory.
      default_cache_dir = user_cache_dir("black")
      cache_dir = Path(
          os.environ.get("BLACK_CACHE_DIR", default_cache_dir)
      )
      cache_dir = cache_dir / __version__
      return cache_dir
  
imports: import hashlib
  import os
  import pickle
  import sys
  import tempfile
  from dataclasses import dataclass, field
  from pathlib import Path
  from typing import Dict, Iterable, NamedTuple, Set, Tuple
  from platformdirs import user_cache_dir
  from _black_version import version
  from black.mode import Mode
label_desc: Use image node_id 1 for calling a global function with example usage: get_cache_dir() and returns: cache_dir