Validate the supplied privileges

def _validate_privileges(object_type, privs, privileges):
    '''
    Validate the supplied privileges
    '''
    if object_type != 'group':
        _perms = [_PRIVILEGES_MAP[perm]
                for perm in _PRIVILEGE_TYPE_MAP[object_type]]
        _perms.append('ALL')

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

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