def normalize_rgb(r, g, b, a):
r = int(r, <NUM_LIT:10>)<EOL>g = int(g, <NUM_LIT:10>)<EOL>b = int(b, <NUM_LIT:10>)<EOL>if a:<EOL><INDENT>a = float(a) * <NUM_LIT><EOL><DEDENT>if r > <NUM_LIT:255> or g > <NUM_LIT:255> or b > <NUM_LIT:255> or (a and a > <NUM_LIT:255>):<EOL><INDENT>return None<EOL><DEDENT>color = '<STR_LIT>' % (r, g, b)<EOL>if a:<EOL><INDENT>color += '<STR_LIT>' % int(a)<EOL><DEDENT>return color<EOL>
Transform a rgb[a] color to #hex[a].