def tweak_message(message):
if isinstance(message, basestring):<EOL><INDENT>message = strip_whitespace(message)<EOL><DEDENT>elif isinstance(message, tuple):<EOL><INDENT>if len(message) == <NUM_LIT:2>:<EOL><INDENT>message = add_context(message[<NUM_LIT:1>], message[<NUM_LIT:0>])<EOL><DEDENT>elif len(message) == <NUM_LIT:3>:<EOL><INDENT>if all(isinstance(x, basestring) for x in message[:<NUM_LIT:2>]):<EOL><INDENT>singular, plural, num = message<EOL>message = (strip_whitespace(singular),<EOL>strip_whitespace(plural),<EOL>num)<EOL><DEDENT><DEDENT>elif len(message) == <NUM_LIT:4>:<EOL><INDENT>singular, plural, num, ctxt = message<EOL>message = (add_context(ctxt, strip_whitespace(singular)),<EOL>add_context(ctxt, strip_whitespace(plural)),<EOL>num)<EOL><DEDENT><DEDENT>return message<EOL>
We piggyback on jinja2's babel_extract() (really, Babel's extract_*
    functions) but they don't support some things we need so this function will
    tweak the message.  Specifically:

        1) We strip whitespace from the msgid.  Jinja2 will only strip
            whitespace from the ends of a string so linebreaks show up in
            your .po files still.

        2) Babel doesn't support context (msgctxt).  We hack that in ourselves
            here.