code: def rgb(x):
      """Return a triple representing rgb color.
  
      Can convert colors by name or hexcode. Passing in a valid rgb tuple is
      idempotent.
  
      Example
      -------
      >>> rgb('plum')
      (221, 160, 221)
      >>> rgb('#FFFFFF')
      (255, 255, 255)
      >>> rgb((255, 255, 255))
      (255, 255, 255)
      """
      if isinstance(x, str):
          if x.startswith("#"):
              return hex_to_rgb(x)
          elif x in color_lookup:
              return hex_to_rgb(color_lookup[x])
          else:
              raise ValueError("Unknown color: '{0}'".format(x))
      elif isinstance(x, tuple) and len(x) == 3:
          if min(x) < 0 or max(x) > 255:
              raise ValueError("Invalid RGB tuple")
      else:
          raise TypeError(
              "Don't know how to convert {0} to RGB".format(x)
          )
      return x
  
imports: from __future__ import annotations
label_desc: Use image node_id 2 for calling a global function with example usage: rgb(x) and returns: x, hex_to_rgb, hex_to_rgb