<s> from __future__ import unicode_literals <EOL> import re <EOL> from django . utils . translation import ugettext as _ <EOL> from django . conf import settings <EOL> from django . utils import translation <EOL> _PATTERN_POLL = re . compile ( <EOL> r'<STR_LIT>' <EOL> r'<STR_LIT>' <EOL> r'<STR_LIT>' , <EOL> flags = re . MULTILINE <EOL> ) <EOL> def _strip_polls ( comment ) : <EOL> return re . sub ( <EOL> _PATTERN_POLL , <EOL> r'<STR_LIT>' , <EOL> comment <EOL> ) <EOL> def quotify ( comment , username ) : <EOL> """<STR_LIT>""" <EOL> with translation . override ( settings . LANGUAGE_CODE ) : <EOL> header = _ ( "<STR_LIT>" ) % { '<STR_LIT:username>' : username , } <EOL> comment = _strip_polls ( comment ) <EOL> lines = comment . splitlines ( ) <EOL> quote = "<STR_LIT>" . join ( lines ) <EOL> quote = "<STR_LIT>" % { '<STR_LIT>' : header , '<STR_LIT>' : quote } <EOL> return quote </s>
