code: def _check_stim_channel(
      stim_channel,
      ch_names,
      tal_ch_names=["EDF Annotations", "BDF Annotations"],
  ):
      """Check that the stimulus channel exists in the current datafile."""
      DEFAULT_STIM_CH_NAMES = ["status", "trigger"]
  
      if stim_channel is None or stim_channel is False:
          return [], []
  
      if stim_channel is True:  # convenient aliases
          stim_channel = "auto"
  
      elif isinstance(stim_channel, str):
          if stim_channel == "auto":
              if "auto" in ch_names:
                  warn(
                      RuntimeWarning,
                      "Using `stim_channel='auto'` when auto"
                      " also corresponds to a channel name is ambiguous."
                      " Please use `stim_channel=['auto']`.",
                  )
              else:
                  valid_stim_ch_names = DEFAULT_STIM_CH_NAMES
          else:
              valid_stim_ch_names = [stim_channel.lower()]
  
      elif isinstance(stim_channel, int):
          valid_stim_ch_names = [ch_names[stim_channel].lower()]
  
      elif isinstance(stim_channel, list):
          if all([isinstance(s, str) for s in stim_channel]):
              valid_stim_ch_names = [s.lower() for s in stim_channel]
          elif all([isinstance(s, int) for s in stim_channel]):
              valid_stim_ch_names = [
                  ch_names[s].lower() for s in stim_channel
              ]
          else:
              raise ValueError("Invalid stim_channel")
      else:
          raise ValueError("Invalid stim_channel")
  
      # Forbid the synthesis of stim channels from TAL Annotations
      tal_ch_names_found = [
          ch
          for ch in valid_stim_ch_names
          if ch in [t.lower() for t in tal_ch_names]
      ]
      if len(tal_ch_names_found):
          _msg = (
              "The synthesis of the stim channel is not supported since 0.18. Please "
              f"remove {tal_ch_names_found} from `stim_channel` and use "
              "`mne.events_from_annotations` instead."
          )
          raise ValueError(_msg)
  
      ch_names_low = [ch.lower() for ch in ch_names]
      found = list(set(valid_stim_ch_names) & set(ch_names_low))
  
      if not found:
          return [], []
      else:
          stim_channel_idxs = [ch_names_low.index(f) for f in found]
          names = [ch_names[idx] for idx in stim_channel_idxs]
          return stim_channel_idxs, names
  
imports: import os
  import re
  from datetime import datetime, timedelta, timezone
  import numpy
  from scipy.interpolate import interp1d
  from ..._fiff.constants import FIFF
  from ..._fiff.meas_info import _empty_info, _unique_channel_names
  from ..._fiff.utils import _blk_read_lims, _mult_cal_one
  from ...annotations import Annotations
  from ...filter import resample
  from ...utils import _validate_type, fill_doc, logger, verbose, warn
  from ..base import BaseRaw, _get_scaling
label_desc: Use image node_id 11 for calling a global function with example usage: _check_stim_channel(stim_channel, ch_names, tal_ch_names) and returns: list,  list, list,  list, stim_channel_idxs,  names