Adjust syntax for Python 3.
Add compatibility for __str__/__unicode__ methods.
Add compatibility for dict methods.
Add compatibility for the unicode builtin.
Add compatible imports for Python 3.
Python 3 doesn't have contextlib.nested.
Use force_text to obtain unicode values.
Exceptions don't have a 'message' attribute on Python 3.