if not isinstance(msg, str):
    msg = msg.decode(encoding)
Python: How to force a "print" to use __unicode__ instead of __str__, or otherwise naturally "print" the message without explicitly calling unicode()