def record_patch(rec, diff):
    """Return the JSON-compatible structure that results from applying the
    changes in `diff` to the record `rec`. The parameters must be structures
    compatible with json.dumps *or* strings compatible with json.loads. Note
    that by design, `old == record_patch(new, record_diff(old, new))`"""
    rec, diff = _norm_json_params(rec, diff)
    return json_delta.patch(rec, diff, in_place=False)