Fix reraise on Python 2 and Python 3

Python 2: be a real function, rather than a nested one
Python 3: need to check that value was an Exception