from flask import jsonify


def ok(data=None, message="success"):
    return jsonify({"code": 0, "message": message, "data": data or {}})


def fail(message="error", code=400, data=None):
    return jsonify({"code": code, "message": message, "data": data or {}}), code
