def escape(string):
for ch in ("<STR_LIT:{>","<STR_LIT:}>","<STR_LIT:[>","<STR_LIT:]>","<STR_LIT:(>","<STR_LIT:)>","<STR_LIT:_>","<STR_LIT:|>","<STR_LIT:!>","<STR_LIT:*>","<STR_LIT:+>","<STR_LIT>"):<EOL><INDENT>string = string.replace(ch, "<STR_LIT:\\>"+ch)<EOL><DEDENT>return string<EOL>
Returns the string with control characters for Pattern syntax escaped.
        For example: "hello!" => "hello\!".