docs: def html5_parse_simple_color(input):
      """
      Apply the simple color parsing algorithm from section 2.4.6 of
      HTML5.
  
      """
      # 1. Let input be the string being parsed.
      #
      # 2. If input is not exactly seven characters long, then return an
      #    error.
      if not isinstance(input, unicode) or len(input) != 7:
          raise ValueError(
              u"An HTML5 simple color must be a Unicode string "
              u"exactly seven characters long."
          )
  
      # 3. If the first character in input is not a U+0023 NUMBER SIGN
      #    character (#), then return an error.
      if not input.startswith('#'):
          raise ValueError(
              u"An HTML5 simple color must begin with the "
              u"character '#' (U+0023)."
          )
  
      # 4. If the last six characters of input are not all ASCII hex
      #    digits, then return an error.
      if not all(c in string.hexdigits for c in input[1:]):
          raise ValueError(
              u"An HTML5 simple color must contain exactly six ASCII hex digits."
          )
  
      # 5. Let result be a simple color.
      #
      # 6. Interpret the second and third characters as a hexadecimal
      #    number and let the result be the red component of result.
      #
      # 7. Interpret the fourth and fifth characters as a hexadecimal
      #    number and let the result be the green component of result.
      #
      # 8. Interpret the sixth and seventh characters as a hexadecimal
      #    number and let the result be the blue component of result.
      #
      # 9. Return result.
      return HTML5SimpleColor(
          int(input[1:3], 16),
          int(input[3:5], 16),
          int(input[5:7], 16)
      )