Escape text using an email-like indenting rule.
    As an example, this text::
        >>Brave Sir Robin ran away...
        <img src="malicious_script />*No!*
        >>bravely ran away away...
        I didn't!*<script>malicious code</script>
        >>When danger reared its ugly head, he bravely turned his tail and fled.
        <form onload="malicious"></form>*I never did!*

    will be escaped like this::
        >>Brave Sir Robin ran away...
        &lt;img src="malicious_script /&gt;*No!*
        >>bravely ran away away...
        I didn't!*&lt;script&gt;malicious code&lt;/script&gt;
        >>When danger reared its ugly head, he bravely turned his tail and fled.
        &lt;form onload="malicious"&gt;&lt;/form&gt;*I never did!*

    @param text: the string to escape
    @param indent_txt: the string used for quoting
    @param linebreak_txt: in the text param, string used for linebreaks

def escape_email_quoted_text(text, indent_txt='>>', linebreak_txt='\n'):
    """
    Escape text using an email-like indenting rule.
    As an example, this text::
        >>Brave Sir Robin ran away...
        <img src="malicious_script />*No!*
        >>bravely ran away away...
        I didn't!*<script>malicious code</script>
        >>When danger reared its ugly head, he bravely turned his tail and fled.
        <form onload="malicious"></form>*I never did!*

    will be escaped like this::
        >>Brave Sir Robin ran away...
        &lt;img src="malicious_script /&gt;*No!*
        >>bravely ran away away...
        I didn't!*&lt;script&gt;malicious code&lt;/script&gt;
        >>When danger reared its ugly head, he bravely turned his tail and fled.
        &lt;form onload="malicious"&gt;&lt;/form&gt;*I never did!*

    @param text: the string to escape
    @param indent_txt: the string used for quoting
    @param linebreak_txt: in the text param, string used for linebreaks
    """
    washer = HTMLWasher()
    lines = text.split(linebreak_txt)
    output = ''
    for line in lines:
        line = line.strip()
        nb_indent = 0
        while True:
            if line.startswith(indent_txt):
                nb_indent += 1
                line = line[len(indent_txt):]
            else:
                break
        output += (nb_indent * indent_txt) + washer.wash(line,
                                                         render_unallowed_tags=True) + linebreak_txt
        nb_indent = 0
    return output[:-1]