code: def _user_to_rgba(color, expand=True, clip=False):
      """Convert color(s) from any set of fmts (str/hex/arr) to RGB(A) array"""
      if color is None:
          color = np.zeros(4, np.float32)
      if isinstance(color, str):
          color = _string_to_rgb(color)
      elif isinstance(color, ColorArray):
          color = color.rgba
      # We have to treat this specially
      elif isinstance(color, (list, tuple)):
          if any(isinstance(c, (str, ColorArray)) for c in color):
              color = [
                  _user_to_rgba(c, expand=expand, clip=clip)
                  for c in color
              ]
              if any(len(c) > 1 for c in color):
                  raise RuntimeError(
                      "could not parse colors, are they nested?"
                  )
              color = [c[0] for c in color]
      color = np.atleast_2d(color).astype(np.float32)
      if color.shape[1] not in (3, 4):
          raise ValueError("color must have three or four elements")
      if expand and color.shape[1] == 3:  # only expand if requested
          color = np.concatenate(
              (color, np.ones((color.shape[0], 1))), axis=1
          )
      if color.min() < 0 or color.max() > 1:
          if clip:
              color = np.clip(color, 0, 1)
          else:
              raise ValueError(
                  "Color values must be between 0 and 1 (or use "
                  "clip=True to automatically clip the values)."
              )
      return color
  
imports: from __future__ import division
  import numpy
  from copy import deepcopy
  from ..util import logger
  from ._color_dict import _color_dict
  from .color_space import _hex_to_rgba, _rgb_to_hex, _rgb_to_hsv, _hsv_to_rgb, _rgb_to_lab, _lab_to_rgb
label_desc: Use image node_id 2 for calling a global function with example usage: _user_to_rgba(color, expand, clip) and returns: color