'Load from entity to class based on discriminator.
Rather than instantiating a new Model instance based on the kind
mapping, this creates an instance of the correct model class based
on the entities class-key.
Args:
entity: Entity loaded directly from datastore.
Raises:
KindError when there is no class mapping based on discriminator.'

@classmethod
def from_entity(cls, entity):

    if ((_CLASS_KEY_PROPERTY in entity) and (tuple(entity[_CLASS_KEY_PROPERTY]) != cls.class_key())):
        key = tuple(entity[_CLASS_KEY_PROPERTY])
        try:
            poly_class = _class_map[key]
        except KeyError:
            raise db.KindError(("No    implementation    for    class    '%s'" % (key,)))
        return poly_class.from_entity(entity)
    return super(PolyModel, cls).from_entity(entity)
