code: def _picks_by_type(
      info, meg_combined=False, ref_meg=False, exclude="bads"
  ):
      """Get data channel indices as separate list of tuples.
  
      Parameters
      ----------
      %(info_not_none)s
      meg_combined : bool | 'auto'
          Whether to return combined picks for grad and mag.
          Can be 'auto' to choose based on Maxwell filtering status.
      ref_meg : bool
          If True include CTF / 4D reference channels
      exclude : list of str | str
          List of channels to exclude. If 'bads' (default), exclude channels
          in info['bads'].
  
      Returns
      -------
      picks_list : list of tuples
          The list of tuples of picks and the type string.
      """
      _validate_type(ref_meg, bool, "ref_meg")
      exclude = _check_info_exclude(info, exclude)
      if meg_combined == "auto":
          meg_combined = _mag_grad_dependent(info)
      picks_list = []
      picks_list = {ch_type: list() for ch_type in _DATA_CH_TYPES_SPLIT}
      for k in range(info["nchan"]):
          if info["chs"][k]["ch_name"] not in exclude:
              this_type = channel_type(info, k)
              try:
                  picks_list[this_type].append(k)
              except KeyError:
                  # This annoyance is due to differences in pick_types
                  # and channel_type behavior
                  if this_type == "ref_meg":
                      ch = info["chs"][k]
                      if _triage_meg_pick(ch, ref_meg):
                          if ch["unit"] == FIFF.FIFF_UNIT_T:
                              picks_list["mag"].append(k)
                          elif ch["unit"] == FIFF.FIFF_UNIT_T_M:
                              picks_list["grad"].append(k)
                  else:
                      pass  # not a data channel type
      picks_list = [
          (ch_type, np.array(picks_list[ch_type], int))
          for ch_type in _DATA_CH_TYPES_SPLIT
      ]
      assert _DATA_CH_TYPES_SPLIT[:2] == ("mag", "grad")
      if (
          meg_combined
          and len(picks_list[0][1])
          and len(picks_list[1][1])
      ):
          picks_list.insert(
              0,
              (
                  "meg",
                  np.unique(
                      np.concatenate(
                          [picks_list.pop(0)[1], picks_list.pop(0)[1]]
                      )
                  ),
              ),
          )
      picks_list = [p for p in picks_list if len(p[1])]
      return picks_list
  
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 19 for calling a global function with example usage: _picks_by_type(info, meg_combined, ref_meg, exclude) and returns: picks_list