python 3 style exception capture