Python-3-style exception handling.

The old style is a syntax error under Python 3 :/