code: def to_rgba(colors, alpha):
      
      def is_iterable(var):
          return cbook.iterable(var) and not is_string(var)
  
      def has_alpha(c):
          if isinstance(c, tuple):
              if len(c) == 4:
                  return True
          elif isinstance(c, str):
              if c[0] == '#' and len(c) == 9:
                  return True
          return False
  
      def no_color(c):
          return c is None or c == '' or c.lower() == 'none'
  
      def to_rgba_hex(c, a):
          """
          Conver rgb color to rgba hex value
  
          If color c has an alpha channel, then alpha value
          a is ignored
          """
          _has_alpha = has_alpha(c)
          c = mcolors.to_hex(c, keep_alpha=_has_alpha)
  
          if not _has_alpha:
              arr = colorConverter.to_rgba(c, a)
              return mcolors.to_hex(arr, keep_alpha=True)
  
          return c
  
      if is_iterable(colors):
          if all(no_color(c) for c in colors):
              return 'none'
  
          if is_iterable(alpha):
              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:
          if no_color(colors):
              return colors
          if is_iterable(alpha):
              return [to_rgba_hex(colors, a) for a in alpha]
          else:
              return to_rgba_hex(colors, alpha)
docs: 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.