Python 3 compatibility: exception raising syntax