Validate the supplied privileges

def _validate_default_privileges(object_type, defprivs, defprivileges):
    '''
    Validate the supplied privileges
    '''
    if object_type != 'group':
        _defperms = [_DEFAULT_PRIVILEGES_MAP[defperm]
                for defperm in _DEFAULT_PRIVILEGE_TYPE_MAP[object_type]]
        _defperms.append('ALL')

        if object_type not in _DEFAULT_PRIVILEGES_OBJECTS:
            raise SaltInvocationError(
                'Invalid object_type: {0} provided'.format(object_type))

        if not set(defprivs).issubset(set(_defperms)):
            raise SaltInvocationError(
                'Invalid default privilege(s): {0} provided for object {1}'.format(
                defprivileges, object_type))
    else:
        if defprivileges:
            raise SaltInvocationError(
                'The default privileges option should not '
                'be set for object_type group')