'method used to construct instances from query results
this is where polymorphic deserialization occurs'

@classmethod
def _construct_instance(cls, values):

    if cls._db_map:
        values = dict(((cls._db_map.get(k, k), v) for (k, v) in values.items()))
    if cls._is_polymorphic:
        disc_key = values.get(cls._discriminator_column_name)
        if (disc_key is None):
            raise PolymorphicModelException('discriminator    value    was    not    found    in    values')
        poly_base = (cls if cls._is_polymorphic_base else cls._polymorphic_base)
        klass = poly_base._get_model_by_discriminator_value(disc_key)
        if (klass is None):
            poly_base._discover_polymorphic_submodels()
            klass = poly_base._get_model_by_discriminator_value(disc_key)
            if (klass is None):
                raise PolymorphicModelException('unrecognized    discriminator    column    {0}    for    class    {1}'.format(disc_key, poly_base.__name__))
        if (not issubclass(klass, cls)):
            raise PolymorphicModelException('{0}    is    not    a    subclass    of    {1}'.format(klass.__name__, cls.__name__))
        values = dict(((k, v) for (k, v) in values.items() if (k in klass._columns.keys())))
    else:
        klass = cls
    instance = klass(**values)
    instance._set_persisted(force=True)
    return instance
