def replace_simple_tags(s, from_tag='<STR_LIT>', to_tag='<STR_LIT:i>', to_open_tag=None):
if to_open_tag:<EOL><INDENT>s = s.replace('<STR_LIT:<>' + from_tag + '<STR_LIT:>>', to_open_tag)<EOL><DEDENT>elif to_tag:<EOL><INDENT>s = s.replace('<STR_LIT:<>' + from_tag + '<STR_LIT:>>', '<STR_LIT:<>' + to_tag + '<STR_LIT:>>')<EOL>s = s.replace('<STR_LIT:<>' + from_tag + '<STR_LIT>', '<STR_LIT:<>' + to_tag + '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>s = s.replace('<STR_LIT:<>' + from_tag + '<STR_LIT:>>', '<STR_LIT>')<EOL>s = s.replace('<STR_LIT:<>' + from_tag + '<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>if to_tag:<EOL><INDENT>s = s.replace('<STR_LIT>' + from_tag + '<STR_LIT:>>', '<STR_LIT>' + to_tag + '<STR_LIT:>>')<EOL><DEDENT>else:<EOL><INDENT>s = s.replace('<STR_LIT>' + from_tag + '<STR_LIT:>>', '<STR_LIT>')<EOL><DEDENT>return s<EOL>
Replace tags such as <italic> to <i>
This does not validate markup