code: def channel_type(info, idx):
      """Get channel type.
  
      Parameters
      ----------
      %(info_not_none)s
      idx : int
          Index of channel.
  
      Returns
      -------
      type : str
          Type of channel. Will be one of::
  
              {'grad', 'mag', 'eeg', 'csd', 'stim', 'eog', 'emg', 'ecg',
               'ref_meg', 'resp', 'exci', 'ias', 'syst', 'misc', 'seeg', 'dbs',
                'bio', 'chpi', 'dipole', 'gof', 'ecog', 'hbo', 'hbr',
                'temperature', 'gsr', 'eyetrack'}
      """
      # This is faster than the original _channel_type_old now in test_pick.py
      # because it uses (at most!) two dict lookups plus one conditional
      # to get the channel type string.
      ch = info["chs"][idx]
      try:
          first_kind = _first_rule[ch["kind"]]
      except KeyError:
          raise ValueError(
              f'Unknown channel type ({ch["kind"]}) for channel "{ch["ch_name"]}"'
          )
      if first_kind in _second_rules:
          key, second_rule = _second_rules[first_kind]
          first_kind = second_rule[ch[key]]
      return first_kind
  
imports: import re
  from copy import deepcopy
  import numpy
  from ..utils import _check_option, _ensure_int, _validate_type, fill_doc, logger, verbose, warn
  from .constants import FIFF
label_desc: Use image node_id 2 for calling a global function with example usage: channel_type(info, idx) and returns: first_kind