<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def inflate(cls, values, **context):
 """ Returns a new record instance for the given class with the values defined from the database. :param cls | <subclass of orb.Table> values | <dict> values :return <orb.Table> """

        context = orb.Context(**context)

        # inflate values from the database into the given class type
        if isinstance(values, Model):
            record = values
            values = dict(values)
        else:
            record = None

        schema = cls.schema()
        polymorphs = schema.columns(flags=orb.Column.Flags.Polymorphic).values()
        column = polymorphs[0] if polymorphs else None

        # attempt to expand the class to its defined polymorphic type
        if column and column.field() in values:
            morph_cls_name = values.get(column.name(), values.get(column.field()))
            morph_cls = orb.system.model(morph_cls_name)
            id_col = schema.idColumn().name()
            if morph_cls and morph_cls != cls:
                try:
                    record = morph_cls(values[id_col], context=context)
                except KeyError:
                    raise orb.errors.RecordNotFound(schema=morph_cls.schema(),
                                                    column=values.get(id_col))

        if record is None:
            event = orb.events.LoadEvent(record=record, data=values)
            record = cls(loadEvent=event, context=context)

        return record