code: def string2rgba(cls, colorstring):
          
          colorstring = colorstring.strip()
          if colorstring[0] == '#':
              colorstring = colorstring[1:]
          if len(colorstring) < 6:
              raise ValueError("input #%s is not in #RRGGBB format" % colorstring)
          r, g, b = colorstring[:2], colorstring[2:4], colorstring[4:6]
          a = 'ff'
          if len(colorstring) > 6:
              a = colorstring[6:8]
          r, g, b, a = [int(n, 16) for n in (r, g, b, a)]
          return (r, g, b, a)
docs: Convert #RRGGBBAA to an (R, G, B, A) tuple