code: def _check_in_testing_and_raise(name, download):
      """Check if we're in an MNE test and raise an error if download!=False."""
      root_dirs = [
          importlib.import_module(ns)
          for ns in _MODULES_TO_ENSURE_DOWNLOAD_IS_FALSE_IN_TESTS
      ]
      root_dirs = [str(Path(ns.__file__).parent) for ns in root_dirs]
      check = False
      func = None
      frame = inspect.currentframe()
      try:
          # First, traverse out of the data_path() call
          while frame:
              if frame.f_code.co_name in ("data_path", "load_data"):
                  func = frame.f_code.co_name
                  frame = (
                      frame.f_back.f_back
                  )  # out of verbose decorator
                  break
              frame = frame.f_back
          # Next, see what the caller was
          while frame:
              fname = frame.f_code.co_filename
              if fname is not None:
                  fname = Path(fname)
                  # in mne namespace, and
                  # (can't use is_relative_to here until 3.9)
                  if any(
                      str(fname).startswith(rd) for rd in root_dirs
                  ) and (
                      # in tests/*.py
                      fname.parent.stem == "tests"
                      or
                      # or in a conftest.py
                      fname.stem == "conftest.py"
                  ):
                      check = True
                      break
              frame = frame.f_back
      finally:
          del frame
      if check and download is not False:
          raise RuntimeError(
              f"Do not download dataset {repr(name)} in tests, pass "
              f"{func}(download=False) to prevent accidental downloads"
          )
  
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 4 for calling a global function with example usage: _check_in_testing_and_raise(name, download) without return types