@sessioned
    def get_active_stream(self, name, dist_traits, current_time, session=None):
        q = session.query(models.Stream)
        q = q.filter(models.Stream.name == name)
        q = q.filter(models.Stream.state == int(models.StreamState.active))
        q = q.filter(current_time > models.Stream.expire_timestamp)
        for name, val in dist_traits.items():
            q = q.filter(models.Stream.distinguished_by.any(and_(
                models.DistinguishingTrait.name == name,
                models.DistinguishingTrait.value == val)))
        return q.first()
dataset/ETHPy150Open openstack/stacktach-winchester/winchester/db/interface.py/DBInterface.get_active_stream/swapped operands of `>`