how about `return query.filter(active=True)` ?