string formatting for hex colors in python,print('{0:06x}'.format(123))