code: def _get_path(path, key, name):
      """Get a dataset path."""
      # 1. Input
      _validate_type(path, ("path-like", None), path)
      if path is not None:
          return Path(path).expanduser()
      # 2. get_config(key) — unless key is None or "" (special get_config values)
      # 3. get_config('MNE_DATA')
      path = get_config(key or "MNE_DATA", get_config("MNE_DATA"))
      if path is not None:
          path = Path(path).expanduser()
          if not path.exists():
              msg = (
                  f"Download location {path} as specified by MNE_DATA does "
                  f"not exist. Either create this directory manually and try "
                  f"again, or set MNE_DATA to an existing directory."
              )
              raise FileNotFoundError(msg)
          return path
      # 4. ~/mne_data (but use a fake home during testing so we don't
      #    unnecessarily create ~/mne_data)
      logger.info("Using default location ~/mne_data for %s..." % name)
      path = op.join(
          os.getenv("_MNE_FAKE_HOME_DIR", op.expanduser("~")),
          "mne_data",
      )
      if not op.exists(path):
          logger.info("Creating ~/mne_data")
          try:
              os.mkdir(path)
          except OSError:
              raise OSError(
                  "User does not have write permissions "
                  "at '%s', try giving the path as an "
                  "argument to data_path() where user has "
                  "write permissions, for ex:data_path"
                  "('/home/xyz/me2/')" % (path)
              )
      return Path(path).expanduser()
  
imports: import importlib
  import inspect
  import logging
  import os
  import os.path
  import sys
  import tempfile
  import time
  import zipfile
  from collections import OrderedDict
  from pathlib import Path
  import numpy
  from ..label import Label, read_labels_from_annot, write_labels_to_annot
  from ..utils import _pl, _safe_input, _validate_type, get_config, get_subjects_dir, logger, set_config, verbose
  from ..utils.docs import _docformat, docdict
  from .config import MNE_DATASETS, _hcp_mmp_license_text
label_desc: Use image node_id 2 for calling a global function with example usage: _get_path(path, key, name) and returns: Path, Path, path