def hex_repr(d):
txt = []<EOL>for k, v in sorted(d.items()):<EOL><INDENT>if isinstance(v, int):<EOL><INDENT>txt.append("<STR_LIT>" % (k, nice_hex(v)))<EOL><DEDENT>else:<EOL><INDENT>txt.append("<STR_LIT>" % (k, v))<EOL><DEDENT><DEDENT>return "<STR_LIT:U+0020>".join(txt)<EOL>
>>> hex_repr({"A":0x1,"B":0xabc})
'A=$01 B=$0abc'