code: def _picks_str_to_idx(
      info,
      picks,
      exclude,
      with_ref_meg,
      return_kind,
      extra_repr,
      allow_empty,
      orig_picks,
  ):
      """Turn a list of str into ndarray of int."""
      # special case for _picks_to_idx w/no info: shouldn't really happen
      if isinstance(info, int):
          raise ValueError(
              "picks as str can only be used when measurement "
              "info is available"
          )
  
      #
      # first: check our special cases
      #
  
      picks_generic = list()
      if len(picks) == 1:
          if picks[0] in ("all", "data", "data_or_ica"):
              if picks[0] == "all":
                  use_exclude = (
                      info["bads"] if exclude == "bads" else exclude
                  )
                  picks_generic = pick_channels(
                      info["ch_names"],
                      info["ch_names"],
                      exclude=use_exclude,
                  )
              elif picks[0] == "data":
                  picks_generic = _pick_data_channels(
                      info, exclude=exclude, with_ref_meg=with_ref_meg
                  )
              elif picks[0] == "data_or_ica":
                  picks_generic = _pick_data_or_ica(
                      info, exclude=exclude
                  )
              if (
                  len(picks_generic) == 0
                  and orig_picks is None
                  and not allow_empty
              ):
                  raise ValueError(
                      f"picks ({repr(orig_picks) + extra_repr}) yielded no channels, "
                      "consider passing picks explicitly"
                  )
  
      #
      # second: match all to channel names
      #
  
      bad_names = []
      picks_name = list()
      for pick in picks:
          try:
              picks_name.append(info["ch_names"].index(pick))
          except ValueError:
              bad_names.append(pick)
  
      #
      # third: match all to types
      #
      bad_type = None
      picks_type = list()
      kwargs = dict(meg=False)
      meg, fnirs, eyetrack = set(), set(), set()
      for pick in picks:
          if pick in _PICK_TYPES_KEYS:
              kwargs[pick] = True
          elif pick in _MEG_CH_TYPES_SPLIT:
              meg |= {pick}
          elif pick in _FNIRS_CH_TYPES_SPLIT:
              fnirs |= {pick}
          elif pick in _EYETRACK_CH_TYPES_SPLIT:
              eyetrack |= {pick}
          else:
              bad_type = pick
              break
      else:
          # bad_type is None but this could still be empty
          bad_type = list(picks)
          # triage MEG, FNIRS, and eyetrack, which are complicated due to non-bool entries
          extra_picks = set()
          if "ref_meg" not in picks and not with_ref_meg:
              kwargs["ref_meg"] = False
          if len(meg) > 0 and not kwargs.get("meg", False):
              # easiest just to iterate
              for use_meg in meg:
                  extra_picks |= set(
                      pick_types(
                          info,
                          meg=use_meg,
                          ref_meg=False,
                          exclude=exclude,
                      )
                  )
          if len(fnirs) and not kwargs.get("fnirs", False):
              idx = 0 if len(fnirs) == 1 else slice(None)
              kwargs["fnirs"] = list(fnirs)[idx]
          if len(eyetrack) and not kwargs.get("eyetrack", False):
              idx = 0 if len(eyetrack) == 1 else slice(None)
              kwargs["eyetrack"] = list(eyetrack)[
                  idx
              ]  # slice(None) is equivalent to all
          picks_type = pick_types(info, exclude=exclude, **kwargs)
          if len(extra_picks) > 0:
              picks_type = sorted(set(picks_type) | set(extra_picks))
  
      #
      # finally: ensure we have exactly one usable list
      #
      all_picks = (picks_generic, picks_name, picks_type)
      any_found = [len(p) > 0 for p in all_picks]
      if sum(any_found) == 0:
          if not allow_empty:
              raise ValueError(
                  f"picks ({repr(orig_picks) + extra_repr}) could not be interpreted as "
                  f'channel names (no channel "{str(bad_names)}"), channel types (no type'
                  f' "{bad_type}" present), or a generic type (just "all" or "data")'
              )
          picks = np.array([], int)
      elif sum(any_found) > 1:
          raise RuntimeError(
              "Some channel names are ambiguously equivalent to "
              "channel types, cannot use string-based "
              "picks for these"
          )
      else:
          picks = np.array(all_picks[np.where(any_found)[0][0]])
  
      picked_ch_type_or_generic = not len(picks_name)
      if len(bad_names) > 0 and not picked_ch_type_or_generic:
          raise ValueError(
              f"Channel(s) {bad_names} could not be picked, because "
              "they are not present in the info instance."
          )
  
      if return_kind:
          return picks, picked_ch_type_or_generic
      return picks
  
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 25 for calling a global function with example usage: _picks_str_to_idx(info, picks, exclude, with_ref_meg, return_kind, extra_repr, allow_empty, orig_picks) and returns: picks, picks,  picked_ch_type_or_generic