def jsend_output(fail_exception_classes=None):
fail_exception_classes = fail_exception_classes if fail_exception_classeselse ()<EOL>def decorator_fn(f):<EOL><INDENT>@wraps(f)<EOL>@json_output<EOL>def jsend_output_decorator(*args, **kwargs):<EOL><INDENT>try:<EOL><INDENT>rv = f(*args, **kwargs)<EOL><DEDENT>except fail_exception_classes as e:<EOL><INDENT>return {'<STR_LIT:status>': '<STR_LIT>', '<STR_LIT:data>': {'<STR_LIT:message>': str(e)}}<EOL><DEDENT>except Exception as e:<EOL><INDENT>logging.error(str(e) + "<STR_LIT:\n>" + traceback.format_exc())<EOL>return {'<STR_LIT:status>': '<STR_LIT:error>', '<STR_LIT:message>': '<STR_LIT>'}<EOL><DEDENT>if not isinstance(rv, dict) and rv is not None:<EOL><INDENT>msg = '<STR_LIT>''<STR_LIT>'<EOL>logging.error(msg.format(rv))<EOL>return {'<STR_LIT:status>': '<STR_LIT:error>', '<STR_LIT:message>': '<STR_LIT>'}<EOL><DEDENT>return {'<STR_LIT:status>': '<STR_LIT:success>', '<STR_LIT:data>': rv}<EOL><DEDENT>return jsend_output_decorator<EOL><DEDENT>return decorator_fn<EOL>
Format task result to json output in jsend specification format. See:
https://github.com/omniti-labs. Task return value must be dict or None.

@param fail_exception_classes: exceptions which will produce 'fail' response
status.