Python 3 compat: Fix some import errors
Python 3 compat: Derive exceptions from Exception
Python 3 compat: Improve WSGI compatibility
Python 3 compat: Remove some unicode and str refs
Python 3 compat: Use bytes where appropriate