Generic Python error handler?