code: def verify_valid_cmap(cmap):
      """Checks that cmap is either a str or list of hex colors"""
      if not (
          isinstance(cmap, (str, list))
          or str(type(cmap)).endswith("unicode'>")
      ):
          emsg = f"Plot color map must be string or list! Not {type(cmap)}."
          raise TypeError(emsg)
  
      if isinstance(cmap, list):
          if len(cmap) < 2:
              raise ValueError("Color map must be at least two colors.")
          _rgbstring = re.compile(r"#[a-fA-F0-9]{6}$")
          for color in cmap:
              if not _rgbstring.match(color):
                  raise ValueError(
                      f"Invalid color {color} found in cmap."
                  )
  
      return cmap
  
imports: import base64
  import json
  import os
  import random
  import re
  import string
  import warnings
  from collections.abc import Sequence
  import numpy
  import pandas
  import scipy.sparse
  from ..plots._force_matplotlib import draw_additive_plot
  from ..utils import hclust_ordering
  from ..utils._exceptions import DimensionError
  from ..utils._legacy import Data, DenseData, Instance, Link, Model, convert_to_link
  from ._labels import labels
label_desc: Use image node_id 7 for calling a global function with example usage: verify_valid_cmap(cmap) and returns: cmap