ported exception syntax to python3 (>=2.6)