code: def _setup_channel_selections(raw, kind, order):
      """Get dictionary of channel groupings."""
      from ..channels import (
          _EEG_SELECTIONS,
          _SELECTIONS,
          _divide_to_regions,
          read_vectorview_selection,
      )
  
      _check_option("group_by", kind, ("position", "selection"))
      if kind == "position":
          selections_dict = _divide_to_regions(raw.info)
          keys = _SELECTIONS[1:]  # omit 'Vertex'
      else:  # kind == 'selection'
          from ..channels.channels import _get_ch_info
  
          (
              has_vv_mag,
              has_vv_grad,
              *_,
              has_neuromag_122_grad,
              has_csd_coils,
          ) = _get_ch_info(raw.info)
          if not (has_vv_grad or has_vv_mag or has_neuromag_122_grad):
              raise ValueError(
                  "order='selection' only works for Neuromag "
                  "data. Use order='position' instead."
              )
          selections_dict = OrderedDict()
          # get stim channel (if any)
          stim_ch = _get_stim_channel(None, raw.info, raise_error=False)
          stim_ch = stim_ch if len(stim_ch) else [""]
          stim_ch = pick_channels(raw.ch_names, stim_ch, ordered=False)
          # loop over regions
          keys = np.concatenate([_SELECTIONS, _EEG_SELECTIONS])
          for key in keys:
              channels = read_vectorview_selection(key, info=raw.info)
              picks = pick_channels(
                  raw.ch_names, channels, ordered=False
              )
              picks = np.intersect1d(picks, order)
              if not len(picks):
                  continue  # omit empty selections
              selections_dict[key] = np.concatenate([picks, stim_ch])
      # add misc channels
      misc = pick_types(
          raw.info,
          meg=False,
          eeg=False,
          stim=True,
          eog=True,
          ecg=True,
          emg=True,
          ref_meg=False,
          misc=True,
          resp=True,
          chpi=True,
          exci=True,
          ias=True,
          syst=True,
          seeg=False,
          bio=True,
          ecog=False,
          fnirs=False,
          dbs=False,
          temperature=True,
          gsr=True,
          exclude=(),
      )
      if len(misc) and np.isin(misc, order).any():
          selections_dict["Misc"] = misc
      return selections_dict
  
file_path: mne-python/mne/viz/raw.py
imports: from collections import OrderedDict
  import numpy
  from .._fiff.pick import pick_channels, pick_types
  from ..defaults import _handle_default
  from ..filter import create_filter
  from ..utils import _check_option, _get_stim_channel, _validate_type, legacy, verbose
  from ..utils.spectrum import _split_psd_kwargs
  from .utils import _check_cov, _compute_scalings, _get_channel_plotting_order, _handle_decim, _handle_precompute, _make_event_color_dict, _shorten_path_from_middle
label_desc: Use image node_id 4 for calling a global function with example usage: _setup_channel_selections(raw, kind, order) and returns: selections_dict