def internal_server_error(e): app.logger.error(traceback.format_exc()) response = flask.Response() response.status_code = 500 if 'stats' not in global_config.flagged_off: handlers.log_request(response) return '<h1>Internal Error</h1><p>Sorry :(</p>', 500