code: def _get_stim_channel(stim_channel, info, raise_error=True):
      """Determine the appropriate stim_channel.
  
      First, 'MNE_STIM_CHANNEL', 'MNE_STIM_CHANNEL_1', 'MNE_STIM_CHANNEL_2', etc.
      are read. If these are not found, it will fall back to 'STI 014' if
      present, then fall back to the first channel of type 'stim', if present.
  
      Parameters
      ----------
      stim_channel : str | list of str | None
          The stim channel selected by the user.
      %(info_not_none)s
  
      Returns
      -------
      stim_channel : list of str
          The name of the stim channel(s) to use
      """
      from .._fiff.pick import pick_types
  
      if stim_channel is not None:
          if not isinstance(stim_channel, list):
              _validate_type(stim_channel, "str", "Stim channel")
              stim_channel = [stim_channel]
          for channel in stim_channel:
              _validate_type(
                  channel, "str", "Each provided stim channel"
              )
          return stim_channel
  
      stim_channel = list()
      ch_count = 0
      ch = get_config("MNE_STIM_CHANNEL")
      while ch is not None and ch in info["ch_names"]:
          stim_channel.append(ch)
          ch_count += 1
          ch = get_config("MNE_STIM_CHANNEL_%d" % ch_count)
      if ch_count > 0:
          return stim_channel
  
      if (
          "STI101" in info["ch_names"]
      ):  # combination channel for newer systems
          return ["STI101"]
      if "STI 014" in info["ch_names"]:  # for older systems
          return ["STI 014"]
  
      stim_channel = pick_types(
          info, meg=False, ref_meg=False, stim=True
      )
      if len(stim_channel) == 0 and raise_error:
          raise ValueError(
              "No stim channels found. Consider specifying them "
              "manually using the 'stim_channel' parameter."
          )
      stim_channel = [info["ch_names"][ch_] for ch_ in stim_channel]
      return stim_channel
  
imports: import atexit
  import json
  import multiprocessing
  import os
  import os.path
  import platform
  import shutil
  import subprocess
  import sys
  import tempfile
  from functools import lru_cache, partial
  from importlib import import_module
  from pathlib import Path
  from urllib.error import URLError
  from urllib.request import urlopen
  from packaging.version import parse
  from ._logging import logger, warn
  from .check import _check_fname, _check_option, _check_qt_version, _validate_type
  from .docs import fill_doc
  from .misc import _pl
label_desc: Use image node_id 9 for calling a global function with example usage: _get_stim_channel(stim_channel, info, raise_error) and returns: stim_channel, stim_channel, stim_channel, list, list