docs: def name_to_hex(name, spec=u'css3'):
      """
      Convert a color name to a normalized hexadecimal color value.
  
      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``.
  
      When no color of that name exists in the given specification,
      ``ValueError`` is raised.
  
      """
      if spec not in SUPPORTED_SPECIFICATIONS:
          raise ValueError(SPECIFICATION_ERROR_TEMPLATE.format(spec=spec))
      normalized = name.lower()
      hex_value = {u'css2': CSS2_NAMES_TO_HEX,
                   u'css21': CSS21_NAMES_TO_HEX,
                   u'css3': CSS3_NAMES_TO_HEX,
                   u'html4': HTML4_NAMES_TO_HEX}[spec].get(normalized)
      if hex_value is None:
          raise ValueError(
              u"'{name}' is not defined as a named color in {spec}".format(
                  name=name, spec=spec
              )
          )
      return hex_value