def validate_data_privacy(request, data, wrapper_kw=None):
    """ Validate :data: contains only data allowed by privacy settings.

    :param request: Pyramid Request instance
    :param data: Dict containing request/response data which should be
        validated
    """
    from nefertari import wrappers
    if wrapper_kw is None:
        wrapper_kw = {}

    wrapper = wrappers.apply_privacy(request)
    allowed_fields = wrapper(result=data, **wrapper_kw).keys()
    data = data.copy()
    data.pop('_type', None)
    not_allowed_fields = set(allowed_fields) - set(data.keys())

    if not_allowed_fields:
        raise wrappers.ValidationError(', '.join(not_allowed_fields))
dataset/ETHPy150Open ramses-tech/nefertari/nefertari/utils/utils.py/validate_data_privacy/swapped operands of `-`