def email_quoted_txt2html(text,<EOL>tabs_before=<NUM_LIT:0>,<EOL>indent_txt='<STR_LIT>',<EOL>linebreak_txt="<STR_LIT:\n>",<EOL>indent_html=('<STR_LIT>', "<STR_LIT>"),<EOL>linebreak_html='<STR_LIT>',<EOL>indent_block=True):
washer = HTMLWasher()<EOL>final_body = "<STR_LIT>"<EOL>nb_indent = <NUM_LIT:0><EOL>text = text.strip('<STR_LIT:\n>')<EOL>lines = text.split(linebreak_txt)<EOL>for line in lines:<EOL><INDENT>new_nb_indent = <NUM_LIT:0><EOL>while True:<EOL><INDENT>if line.startswith(indent_txt):<EOL><INDENT>new_nb_indent += <NUM_LIT:1><EOL>line = line[len(indent_txt):]<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>if indent_block:<EOL><INDENT>if (new_nb_indent > nb_indent):<EOL><INDENT>for dummy in range(nb_indent, new_nb_indent):<EOL><INDENT>final_body += tabs_before * "<STR_LIT:\t>" + indent_html[<NUM_LIT:0>] + "<STR_LIT:\n>"<EOL>tabs_before += <NUM_LIT:1><EOL><DEDENT><DEDENT>elif (new_nb_indent < nb_indent):<EOL><INDENT>for dummy in range(new_nb_indent, nb_indent):<EOL><INDENT>tabs_before -= <NUM_LIT:1><EOL>final_body += (tabs_before) * "<STR_LIT:\t>" + indent_html[<NUM_LIT:1>] + "<STR_LIT:\n>"<EOL><DEDENT><DEDENT>else:<EOL><INDENT>final_body += (tabs_before) * "<STR_LIT:\t>"<EOL><DEDENT><DEDENT>else:<EOL><INDENT>final_body += tabs_before * "<STR_LIT:\t>" + new_nb_indent * indent_html[<NUM_LIT:0>]<EOL><DEDENT>try:<EOL><INDENT>line = washer.wash(line)<EOL><DEDENT>except HTMLParseError:<EOL><INDENT>line = cgi.escape(line)<EOL><DEDENT>if indent_block:<EOL><INDENT>final_body += tabs_before * "<STR_LIT:\t>"<EOL><DEDENT>final_body += line<EOL>if not indent_block:<EOL><INDENT>final_body += new_nb_indent * indent_html[<NUM_LIT:1>]<EOL><DEDENT>final_body += linebreak_html + "<STR_LIT:\n>"<EOL>nb_indent = new_nb_indent<EOL><DEDENT>if indent_block:<EOL><INDENT>for dummy in range(<NUM_LIT:0>, nb_indent):<EOL><INDENT>tabs_before -= <NUM_LIT:1><EOL>final_body += (tabs_before) * "<STR_LIT:\t>" + "<STR_LIT>"<EOL><DEDENT><DEDENT>return final_body<EOL>
Takes a typical mail quoted text, e.g.::
    hello,
    you told me:
    >> Your mother was a hamster and your father smelt of elderberries
    I must tell you that I'm not convinced. Then in this discussion:
    >>>> Is there someone else up there we could talk to?
    >> No. Now, go away, or I shall taunt you a second time-a!
    I think we're not going to be friends!

and return an html formatted output, e.g.::
    hello,<br/>
    you told me:<br/>
    <div>
      Your mother was a hamster and your father smelt of elderberries
    </div>
    I must tell you that I'm not convinced. Then in this discussion:
    <div>
      <div>
        Is there someone else up there we could talk to?
      </div>
      No. Now, go away, or I shall taunt you a second time-a!
    </div>
    I think we're not going to be friends!

The behaviour is different when C{indent_block} is C{True} or C{False}.
When C{True} the when C{indent_html} is only added at each change of
level of indentation, while it is added for each line when C{False}.
For eg::
    >> a
    >> b
    >>>> c

would result in (if C{True})::
    <div class="commentbox">
        a<br/>
        b<br/>
        <div class="commentbox">
            c<br/>
        </div>
    </div>

or would be (if C{False})::
    <div class="commentbox"> a</div><br/>
    <div class="commentbox"> b</div><br/>
    <div class="commentbox"><div class="commentbox"> c</div></div><br/>

@param text: the text in quoted format
@param tabs_before: number of tabulations before each line
@param indent_txt: quote separator in email (default:'>>')
@param linebreak_txt: line separator in email
@param indent_html: tuple of (opening, closing) html tags.
                    default: ('<div class="commentbox">', "</div>")
@param linebreak_html: line separator in html (default: '<br/>')
@param indent_block: if indentation should be done per 'block'
                     i.e. only at changes of indentation level
                     (+1, -1) or at each line.
@return: string containing html formatted output