code: def _validate_colors_pce(colors, cmap, conditions, tags):
      """Check and assign colors for plot_compare_evokeds."""
      err_suffix = ""
      if colors is None:
          if cmap is None:
              colors = _get_color_list()
              err_suffix = " in the default color cycle"
          else:
              colors = list(range(len(conditions)))
      # convert color list to dict
      if isinstance(colors, (list, tuple, np.ndarray)):
          if len(conditions) > len(colors):
              raise ValueError(
                  f"Trying to plot {len(conditions)} conditions, but there are only "
                  f"{len(colors)} colors{err_suffix}. Please specify colors manually."
              )
          colors = dict(zip(conditions, colors))
      # should be a dict by now...
      if not isinstance(colors, dict):
          raise TypeError(
              f'"colors" must be a dict, list, or None; got {type(colors).__name__}.'
          )
      # validate color dict keys
      if not set(colors).issubset(tags.union(conditions)):
          raise ValueError(
              f'If "colors" is a dict its keys ({list(colors)}) must match the '
              f'keys/conditions in "evokeds" ({conditions}).'
          )
      # validate color dict values
      color_vals = list(colors.values())
      all_numeric = all(_is_numeric(_color) for _color in color_vals)
      if cmap is not None and not all_numeric:
          raise TypeError(
              'if "cmap" is specified, then "colors" must be '
              "None or a (list or dict) of (ints or floats); got {}.".format(
                  ", ".join(color_vals)
              )
          )
      # convert provided ints to sequential, rank-ordered ints
      all_int = all(
          isinstance(_color, Integral) for _color in color_vals
      )
      if all_int:
          colors = deepcopy(colors)
          ranks = {
              val: ix for ix, val in enumerate(sorted(set(color_vals)))
          }
          for key, orig_int in colors.items():
              colors[key] = ranks[orig_int]
          # if no cmap, convert color ints to real colors
          if cmap is None:
              color_list = _get_color_list()
              for cond, color_int in colors.items():
                  colors[cond] = color_list[color_int]
      # recompute color_vals as a sorted set (we'll need it that way later)
      color_vals = set(colors.values())
      if all_numeric:
          color_vals = sorted(color_vals)
      return colors, color_vals
  
imports: from copy import deepcopy
  from functools import partial
  from itertools import cycle
  from numbers import Integral
  import numpy
  from .._fiff.pick import _DATA_CH_TYPES_SPLIT, _PICK_TYPES_DATA_DICT, _VALID_CHANNEL_TYPES, _picks_to_idx, channel_indices_by_type, channel_type, pick_info
  from ..defaults import _handle_default
  from ..fixes import _is_last_row
  from ..utils import _check_ch_locs, _check_if_nan, _clean_names, _is_numeric, _pl, _to_rgb, _validate_type, fill_doc, logger, verbose, warn
  from .topo import _plot_evoked_topo
  from .topomap import _check_sphere, _draw_outlines, _get_pos_outlines, _make_head_outlines, _prepare_topomap, _prepare_topomap_plot, _set_contour_locator, plot_topomap
  from .utils import DraggableColorbar, _check_cov, _check_delayed_ssp, _check_option, _check_time_unit, _draw_proj_checkbox, _get_cmap, _get_color_list, _make_combine_callable, _plot_masked_image, _prepare_joint_axes, _process_times, _prop_kw, _set_title_multiple_electrodes, _set_window_title, _setup_ax_spines, _setup_cmap, _setup_plot_projector, _setup_vmin_vmax, _triage_rank_sss, _trim_ticks, _validate_if_list_of_axes, plt_show
label_desc: Use image node_id 22 for calling a global function with example usage: _validate_colors_pce(colors, cmap, conditions, tags) and returns: colors,  color_vals