python: Stop using the Python 2 exception syntax