def cors(f):

    @wraps(f)
    def wrapper(*args, **kwargs):
        res = f(*args, **kwargs)
        if request.headers.get('x-cors-status', False):
            if isinstance(res, tuple):
                json_text = res[0].data
                code = res[1]
            else:
                json_text = res.data
                code = 200
            o = json.loads(json_text)
            o['x-status'] = code
            return jsonify(o)
        return res
    return wrapper
def cors(f):

    @wraps(f)
    def wrapper(*args, **kwargs):
        res = f(*args, **kwargs)
        if request.headers.get('x-cors-status', False):
            if isinstance(res, tuple):
                json_text = res[0].data
                code = res[1]
            else:
                json_text = res.data
                code = 200
            o = json.loads(json_text)
            o['x-status'] = code
            return jsonify(o)
        return res
    return wrapper