def METHOD_NAME(query, kwargs, fields):
    for key, column in fields:
        if kwargs.get(key):
            exclude_list = build_exclude_list(kwargs.get(key))
            include_list = build_include_list(kwargs.get(key))
            if exclude_list:
                filters = [
                    sa.not_(column.match(utils.parse_fulltext(value)))
                    for value in exclude_list
                ]
                query = query.filter(sa.and_(*filters))
            if include_list:
                filters = []
                for value in include_list:
                    filters.append(column.match(utils.parse_fulltext(value)))
                    if value.upper() == 'NULL':
                        filters.append(column.is_(None))
                query = query.filter(sa.or_(*filters))
    return query