code: def color_to_html_format(color):
      """Formats a color given as a 3-tuple or 4-tuple in HTML format.
  
      The HTML format is simply given by C{#rrggbbaa}, where C{rr} gives
      the red component in hexadecimal format, C{gg} gives the green
      component C{bb} gives the blue component and C{gg} gives the
      alpha level. The alpha level is optional.
      """
      color = [
          int(clamp(component * 256, 0, 255)) for component in color
      ]
      if len(color) == 4:
          return "#{0:02X}{1:02X}{2:02X}{3:02X}".format(*color)
      return "#{0:02X}{1:02X}{2:02X}".format(*color)
  
imports: from abc import ABCMeta, abstractmethod
  from math import ceil
label_desc: Use image node_id 4 for calling a global function with example usage: color_to_html_format(color) and returns: str, str