code: def _map_effects(n_factors, effects):
      """Map effects to indices."""
      if n_factors > len(ascii_uppercase):
          raise ValueError("Maximum number of factors supported is 26")
  
      factor_names = list(ascii_uppercase[:n_factors])
  
      if isinstance(effects, str):
          if "*" in effects and ":" in effects:
              raise ValueError('Not "*" and ":" permitted in effects')
          elif "+" in effects and ":" in effects:
              raise ValueError('Not "+" and ":" permitted in effects')
          elif effects == "all":
              effects = None
          elif len(effects) == 1 or ":" in effects:
              effects = [effects]
          elif "+" in effects:
              # all main effects
              effects = effects.split("+")
          elif "*" in effects:
              pass  # handle later
          else:
              raise ValueError(
                  f'"{effects}" is not a valid option for "effects"'
              )
      if isinstance(effects, list):
          bad_names = [e for e in effects if e not in factor_names]
          if len(bad_names) > 1:
              raise ValueError(
                  f"Effect names: {bad_names} are not valid. They should consist of the "
                  f"first `n_factors` ({n_factors}) characters from the alphabet"
              )
  
      indices = list(np.arange(2**n_factors - 1))
      names = list()
      for this_effect in indices:
          contrast_idx = _get_contrast_indices(
              this_effect + 1, n_factors
          )
          this_code = (n_factors - 1) - np.where(contrast_idx == 1)[0]
          this_name = [factor_names[e] for e in this_code]
          this_name.sort()
          names.append(":".join(this_name))
  
      if effects is None or isinstance(effects, str):
          effects_ = names
      else:
          effects_ = effects
  
      selection = [names.index(sel) for sel in effects_]
      names = [names[sel] for sel in selection]
  
      if isinstance(effects, str):
          if "*" in effects:
              # hierarchical order of effects
              # the * based effect can be used as stop index
              sel_ind = names.index(effects.replace("*", ":")) + 1
              names = names[:sel_ind]
              selection = selection[:sel_ind]
  
      return selection, names
  
file_path: mne-python/mne/stats/parametric.py
imports: from functools import reduce
  from string import ascii_uppercase
  import numpy
  from scipy import stats
  from scipy.signal import detrend
  from ..utils import _check_option
label_desc: Use image node_id 4 for calling a global function with example usage: _map_effects(n_factors, effects) and returns: selection,  names