Reworked exceptions for Python 3