def corresponds_to(self, entity):
    if entity.is_aliased_class:
        if self.is_aliased_class:
            if (entity._base_alias is self.entity_zero._base_alias):
                return True
        return False
    elif self.is_aliased_class:
        if self.entity_zero._use_mapper_path:
            return (entity in self._with_polymorphic)
        else:
            return (entity is self.entity_zero)
    return entity.common_parent(self.entity_zero)
def corresponds_to(self, entity):
    if entity.is_aliased_class:
        if self.is_aliased_class:
            if (entity._base_alias is self.entity_zero._base_alias):
                return True
        return False
    elif self.is_aliased_class:
        if self.entity_zero._use_mapper_path:
            return (entity in self._with_polymorphic)
        else:
            return (entity is self.entity_zero)
    return entity.common_parent(self.entity_zero)