code: def vectorized_to_hex(c_values, keep_alpha=False):
      """Convert a color (including vector of colors) to hex.
  
      Parameters
      ----------
      c: Matplotlib color
  
      keep_alpha: boolean
          to select if alpha values should be kept in the final hex values.
  
      Returns
      -------
      rgba_hex : vector of hex values
      """
      try:
          hex_color = to_hex(c_values, keep_alpha)
  
      except ValueError:
          hex_color = [to_hex(color, keep_alpha) for color in c_values]
      return hex_color
  
imports: import importlib
  import warnings
  from typing import Any, Dict
  import matplotlib
  import numpy
  import packaging
  from matplotlib.colors import to_hex
  from scipy.stats import mode, rankdata
  from scipy.interpolate import CubicSpline
  from ..rcparams import rcParams
  from ..stats.density_utils import kde
  from ..stats import hdi
label_desc: Use image node_id 7 for calling a global function with example usage: vectorized_to_hex(c_values, keep_alpha) and returns: hex_color