In Python 3, StringIO lives in the io package
Use smart_text instead of smart_unicode

More info:
https://docs.djangoproject.com/en/dev/topics/python3/#string-handling
The except statement has changed in Python 3

The new syntax has been backported to Python 2.7