code: def rgb_to_hex(Class, r, g, b):
          
          return ("%2s%2s%2s" % 
                  (hex(int(r)).lstrip('0x'), hex(int(g)).lstrip('0x'), hex(int(b)).lstrip('0x'))
              ).replace(' ', '0').upper()
docs: RGB in 0-255 to hex (RRGGBB)