Fix imports for Python 3
Fix deprecated assertions
Add stub file to fix running tests on Python 3
Fix missing attribute exc.message
Use a list comprehension to collect valid_modes
Add .tox to gitignore
Add Python 3.2 and 3.3 to travis