code: def HTMLColorToRGB(colorstring):
      
      colorstring = colorstring.strip()
      if colorstring[0] == '#':
          colorstring = colorstring[1:]
      if len(colorstring) != 6:
          raise ValueError(
              "input #{0} is not in #RRGGBB format".format(colorstring))
      r, g, b = colorstring[:2], colorstring[2:4], colorstring[4:]
      r, g, b = [int(n, 16) for n in (r, g, b)]
      return (r, g, b)
docs: convert #RRGGBB to an (R, G, B) tuple