def error_response(<EOL>error_type="<STR_LIT>",<EOL>error_text="<STR_LIT>",<EOL>status=<NUM_LIT>,<EOL>participant=None,<EOL>simple=False,<EOL>request_data="<STR_LIT>",<EOL>):
last_exception = sys.exc_info()<EOL>if last_exception[<NUM_LIT:0>]:<EOL><INDENT>db.logger.error(<EOL>"<STR_LIT>".format(dict(request.args)),<EOL>exc_info=last_exception,<EOL>)<EOL><DEDENT>data = {"<STR_LIT:status>": "<STR_LIT:error>"}<EOL>if simple:<EOL><INDENT>data["<STR_LIT:message>"] = error_text<EOL><DEDENT>else:<EOL><INDENT>data["<STR_LIT:html>"] = (<EOL>error_page(<EOL>error_text=error_text,<EOL>error_type=error_type,<EOL>participant=participant,<EOL>request_data=request_data,<EOL>)<EOL>.get_data()<EOL>.decode("<STR_LIT:utf-8>")<EOL>)<EOL><DEDENT>return Response(dumps(data), status=status, mimetype="<STR_LIT:application/json>")<EOL>
Return a generic server error response.