def METHOD_NAME(page, project_qs):
    """Apply keywords.
    If keywords exist, check if they should be used for filtering or exclusion.
    """
    if not page.keywords.all():
        return project_qs
    if page.exclude_keywords:
        return project_qs.exclude(keywords__in=page.keywords.all())
    else:
        return project_qs.filter(keywords__in=page.keywords.all())