<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def encode_for_xml(text, wash=False, xml_version='1.0', quote=False):
 """Encode special characters in a text so that it would be XML-compliant. :param text: text to encode :return: an encoded text """

    text = text.replace('&', '&amp;')
    text = text.replace('<', '&lt;')
    if quote:
        text = text.replace('"', '&quot;')
    if wash:
        text = wash_for_xml(text, xml_version=xml_version)
    return text