def encode_for_xml(text, wash=False, xml_version='<STR_LIT:1.0>', quote=False):
text = text.replace('<STR_LIT:&>', '<STR_LIT>')<EOL>text = text.replace('<STR_LIT:<>', '<STR_LIT>')<EOL>if quote:<EOL><INDENT>text = text.replace('<STR_LIT:">', '<STR_LIT>')<EOL><DEDENT>if wash:<EOL><INDENT>text = wash_for_xml(text, xml_version=xml_version)<EOL><DEDENT>return text<EOL>
Encode special characters in a text so that it would be XML-compliant.

    :param text: text to encode
    :return: an encoded text