def _get_filter_items(filter_previously_rated, previously_liked, filter_items):
    """Determine which items to filter out."""
    if filter_previously_rated:
        previously_liked = set(previously_liked)

        if filter_items is not None:
            filter_items = set(filter_items)
            previously_liked = previously_liked.union(filter_items)

        return previously_liked  # type: set
    else:
        if filter_items is not None:
            return set(filter_items)
        else:
            return set()