Except statement compatibility with python 2.5