def responsify(error):
assert str(type(error).__name__) == '<STR_LIT>'<EOL>if error.error in code_to_class:<EOL><INDENT>e = code_to_class[error.error](error.error_description)<EOL>if error.error_id:<EOL><INDENT>e.error_id = error.error_id<EOL><DEDENT>if error.user_message:<EOL><INDENT>e.user_message = error.user_message<EOL><DEDENT>return e.http_reply()<EOL><DEDENT>elif isinstance(error, PyMacaronException):<EOL><INDENT>return error.http_reply()<EOL><DEDENT>else:<EOL><INDENT>return PyMacaronException("<STR_LIT>" % error).http_reply()<EOL><DEDENT>
Take an Error model and return it as a Flask response