use exception syntax both in python 3/2