code: def _get_ecg_channel_index(ch_name, inst):
      """Get ECG channel index, if no channel found returns None."""
      if ch_name is None:
          ecg_idx = pick_types(
              inst.info,
              meg=False,
              eeg=False,
              stim=False,
              eog=False,
              ecg=True,
              emg=False,
              ref_meg=False,
              exclude="bads",
          )
      else:
          if ch_name not in inst.ch_names:
              raise ValueError(
                  "%s not in channel list (%s)"
                  % (ch_name, inst.ch_names)
              )
          ecg_idx = pick_channels(inst.ch_names, include=[ch_name])
  
      if len(ecg_idx) == 0:
          return None
          # raise RuntimeError('No ECG channel found. Please specify ch_name '
          #                    'parameter e.g. MEG 1531')
  
      if len(ecg_idx) > 1:
          warn(
              "More than one ECG channel found. Using only %s."
              % inst.ch_names[ecg_idx[0]]
          )
  
      return ecg_idx[0]
  
file_path: mne-python/mne/preprocessing/ecg.py
imports: import numpy
  from .._fiff.meas_info import create_info
  from .._fiff.pick import _picks_to_idx, pick_channels, pick_types
  from ..annotations import _annotations_starts_stops
  from ..epochs import BaseEpochs, Epochs
  from ..evoked import Evoked
  from ..filter import filter_data
  from ..io import BaseRaw, RawArray
  from ..utils import int_like, logger, sum_squared, verbose, warn
label_desc: Use image node_id 3 for calling a global function with example usage: _get_ecg_channel_index(ch_name, inst) and returns: ecg_idx, None