code: def to_rgba(
      colors: Sequence[ColorType] | AnySeries | ColorType,
      alpha: float | Sequence[float] | AnySeries,
  ) -> Sequence[ColorType] | ColorType:
      """
      Covert hex colors to rgba values.
  
      Parameters
      ----------
      colors : iterable | str
          colors to convert
      alphas : iterable | float
          alpha values
  
      Returns
      -------
      out : ndarray | tuple
          rgba color(s)
  
      Notes
      -----
      Matplotlib plotting functions only accept scalar
      alpha values. Hence no two objects with different
      alpha values may be plotted in one call. This would
      make plots with continuous alpha values innefficient.
      However :), the colors can be rgba hex values or
      list-likes and the alpha dimension will be respected.
      """
      from matplotlib.typing import ColorType
  
      def is_iterable(var):
          return np.iterable(var) and not isinstance(var, str)
  
      def has_alpha(c):
          return (isinstance(c, tuple) and len(c) == 4) or (
              isinstance(c, str) and len(c) == 9 and c[0] == "#"
          )
  
      def no_color(c):
          return c is None or c.lower() in ("none", "")
  
      def to_rgba_hex(c: ColorType, a: float) -> str:
          """
          Conver rgb color to rgba hex value
  
          If color c has an alpha channel, then alpha value
          a is ignored
          """
          from matplotlib.colors import colorConverter, to_hex
  
          if c in ("None", "none"):
              return c
  
          _has_alpha = has_alpha(c)
          c = to_hex(c, keep_alpha=_has_alpha)
  
          if not _has_alpha:
              arr = colorConverter.to_rgba(c, a)
              return to_hex(arr, keep_alpha=True)
  
          return c
  
      if is_iterable(colors):
          colors = cast(Sequence[ColorType], colors)
  
          if all(no_color(c) for c in colors):
              return "none"
  
          if isinstance(alpha, (Sequence, pd.Series)):
              return [to_rgba_hex(c, a) for c, a in zip(colors, alpha)]
          else:
              return [to_rgba_hex(c, alpha) for c in colors]
      else:
          colors = cast(ColorType, colors)
  
          if no_color(colors):
              return colors
  
          if isinstance(alpha, (Sequence, pd.Series)):
              return [to_rgba_hex(colors, a) for a in alpha]
          else:
              return to_rgba_hex(colors, alpha)
  
imports: from __future__ import annotations
  import inspect
  import itertools
  import warnings
  from collections import defaultdict
  from collections.abc import Iterable, Sequence
  from contextlib import suppress
  from typing import TYPE_CHECKING, cast, overload
  from warnings import warn
  import numpy
  import pandas
  from pandas.core.groupby import DataFrameGroupBy
  from ..exceptions import PlotnineError, PlotnineWarning
  from ..mapping import aes
label_desc: Use image node_id 18 for calling a global function with example usage: to_rgba(colors, alpha) and returns: unknown, unknown, unknown, c, c, to_hex, str, unknown, unknown, colors, unknown, to_rgba_hex