def _get_entity_clauses(self, query, context):
    adapter = None
    if (not self.is_aliased_class):
        if query._polymorphic_adapters:
            adapter = query._polymorphic_adapters.get(self.mapper, None)
    else:
        adapter = self.aliased_adapter
    if adapter:
        if query._from_obj_alias:
            ret = adapter.wrap(query._from_obj_alias)
        else:
            ret = adapter
    else:
        ret = query._from_obj_alias
    return ret
def _get_entity_clauses(self, query, context):
    adapter = None
    if (not self.is_aliased_class):
        if query._polymorphic_adapters:
            adapter = query._polymorphic_adapters.get(self.mapper, None)
    else:
        adapter = self.aliased_adapter
    if adapter:
        if query._from_obj_alias:
            ret = adapter.wrap(query._from_obj_alias)
        else:
            ret = adapter
    else:
        ret = query._from_obj_alias
    return ret