def _entity_criterion(self, entity):
        #if hasattr(entity, "property"):
        #    entity = entity.property.mapper
        if hasattr(entity, 'parententity'):
            # XXX is this used?
            entity = entity.parententity
        try:
            cls = _class_to_mapper(entity).class_
        except __HOLE__:
            # XXX For tables, table columns
            #pass
            raise # XXX temporal, to verify it's used
        else:
            alias = entity if isinstance(entity, AliasedClass) else cls
            prop = self.property_name
            if prop in dir(cls):
                crit = getattr(alias, prop)
                if crit is not None:
                    if not isinstance(crit, ClauseElement):
                        # This simplest safe way to make bare boolean column
                        # accepted as expression.
                        crit = cast(crit, Boolean)
                    return crit
        return None
dataset/ETHPy150Open SmartTeleMax/iktomi/iktomi/unstable/db/sqla/public_query.py/PublicQuery._entity_criterion