code: def hex_to_name(hex_value, spec='css3'):
      
      if spec not in SUPPORTED_SPECIFICATIONS:
          raise TypeError("'%s' is not a supported specification for color name lookups; supported specifications are: %s." % (spec,
                                                                                                                               ', '.join(SUPPORTED_SPECIFICATIONS)))
      normalized = normalize_hex(hex_value)
      try:
          name = globals()['%s_hex_to_names' % spec][normalized]
      except KeyError:
          raise ValueError("'%s' has no defined color name in %s." % (hex_value, spec))
      return name
docs: Convert a hexadecimal color value to its corresponding normalized
      color name, if any such name exists.
  
      The optional keyword argument ``spec`` determines which
      specification's list of color names will be used; valid values are
      ``html4``, ``css2``, ``css21`` and ``css3``, and the default is
      ``css3``.
  
      The hexadecimal value will be normalized before being looked up,
      and when no color name for the value is found in the given
      specification, ``ValueError`` is raised.
  
      Examples:
  
      >>> hex_to_name('#ffffff')
      'white'
      >>> hex_to_name('#fff')
      'white'
      >>> hex_to_name('#000080')
      'navy'
      >>> hex_to_name('#daa520')
      'goldenrod'
      >>> hex_to_name('#daa520', spec='html4')
      Traceback (most recent call last):
          ...
      ValueError: '#daa520' has no defined color name in html4.
      >>> hex_to_name('#daa520', spec='css5')
      Traceback (most recent call last):
          ...
      TypeError: 'css5' is not a supported specification for color name lookups; supported specifications are: html4, css2, css21, css3.