def METHOD_NAME(oso, engine):
    public_tag = Tag(name="public", is_public=True)
    private_tag = Tag(name="private", is_public=False)
    post0 = Post(id=0, contents="public tag", tags=[public_tag])
    post1 = Post(id=1, contents="no tags", tags=[])
    post2 = Post(id=2, contents="both tags", tags=[public_tag, private_tag])
    post3 = Post(id=3, contents="public tag 2", tags=[public_tag])
    post4 = Post(id=4, contents="private tag", tags=[private_tag])
    session = Session(bind=engine)
    session.add_all([public_tag, private_tag, post0, post1, post2, post3, post4])
    session.commit()
    oso.load_str(
        """
        allow(_, _, post: Post) if
            forall(tag in post.tags, tag.is_public = true);
    """
    )
    authz_session = AuthorizedSession(
        oso=oso, user="u", checked_permissions={Post: "a"}, bind=engine
    )
    posts = authz_session.query(Post).all()
    post_ids = [p.id for p in posts]
    assert len(posts) == 2
    assert 0 in post_ids
    assert 3 in post_ids