code: def _check_n_jobs(n_jobs):
      n_jobs = _ensure_int(n_jobs, "n_jobs", must_be="an int or None")
      if (
          os.getenv("MNE_FORCE_SERIAL", "").lower() in ("true", "1")
          and n_jobs != 1
      ):
          n_jobs = 1
          logger.info(
              "... MNE_FORCE_SERIAL set. Processing in forced "
              "serial mode."
          )
      elif n_jobs <= 0:
          n_cores = multiprocessing.cpu_count()
          n_jobs_orig = n_jobs
          n_jobs = min(n_cores + n_jobs + 1, n_cores)
          if n_jobs <= 0:
              raise ValueError(
                  f"If n_jobs has a non-positive value ({n_jobs_orig}) it must "
                  f"not be less than the number of CPUs present ({n_cores})"
              )
      return n_jobs
  
imports: import logging
  import multiprocessing
  import os
  from .utils import ProgressBar, _ensure_int, _validate_type, get_config, logger, use_log_level, verbose, warn
label_desc: Use image node_id 2 for calling a global function with example usage: _check_n_jobs(n_jobs) and returns: n_jobs