code: def _get_xdg_cache_dir():
      """
      Return the XDG cache directory.
  
      See
      https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
      """
      cache_dir = os.environ.get("XDG_CACHE_HOME")
      if not cache_dir:
          cache_dir = os.path.expanduser("~/.cache")
          if cache_dir.startswith("~/"):  # Expansion failed.
              return None
      return Path(cache_dir, "matplotlib")
  
imports: import urllib.request
  from io import BytesIO
  import os
  from pathlib import Path
label_desc: Use image node_id 2 for calling a global function with example usage: _get_xdg_cache_dir() and returns: Path, None