def enc(x, codec='<STR_LIT:ascii>'):
x = x.replace('<STR_LIT:&>', '<STR_LIT>').replace('<STR_LIT:>>', '<STR_LIT>').replace('<STR_LIT:<>', '<STR_LIT>').replace('<STR_LIT:">', '<STR_LIT>')<EOL>return x.encode(codec, '<STR_LIT>')<EOL>
Encodes a string for SGML/XML/HTML