def normalize_hex(hex_color):
hex_color = hex_color.replace('<STR_LIT:#>', '<STR_LIT>').lower()<EOL>length = len(hex_color)<EOL>if length in (<NUM_LIT:6>, <NUM_LIT:8>):<EOL><INDENT>return '<STR_LIT:#>' + hex_color<EOL><DEDENT>if length not in (<NUM_LIT:3>, <NUM_LIT:4>):<EOL><INDENT>return None<EOL><DEDENT>strhex = u'<STR_LIT>' % (<EOL>hex_color[<NUM_LIT:0>] * <NUM_LIT:2>,<EOL>hex_color[<NUM_LIT:1>] * <NUM_LIT:2>,<EOL>hex_color[<NUM_LIT:2>] * <NUM_LIT:2>)<EOL>if length == <NUM_LIT:4>:<EOL><INDENT>strhex += hex_color[<NUM_LIT:3>] * <NUM_LIT:2><EOL><DEDENT>return strhex<EOL>
Transform a xxx hex color to xxxxxx.