def hex_escape(bin_str):
printable = string.ascii_letters + string.digits + string.punctuation + '<STR_LIT:U+0020>'<EOL>return '<STR_LIT>'.join(ch if ch in printable else r'<STR_LIT>'.format(ord(ch)) for ch in bin_str)<EOL>
Hex encode a binary string