RGB in 0-255 to hex (RRGGBB)

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