<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_xso(self, xso):
 """ Construct and return an instance from the given `xso`. .. note:: This is a static method (classmethod), even though sphinx does not document it as such. :param xso: A :xep:`4` data form :type xso: :class:`~.Data` :raises ValueError: if the ``FORM_TYPE`` mismatches :raises ValueError: if field types mismatch :return: newly created instance of this class The fields from the given `xso` are matched against the fields on the form. Any matching field loads its data from the `xso` field. Fields which occur on the form template but not in the `xso` are skipped. Fields which occur in the `xso` but not on the form template are also skipped (but are re-emitted when the form is rendered as reply, see :meth:`~.Form.render_reply`). If the form template has a ``FORM_TYPE`` attribute and the incoming `xso` also has a ``FORM_TYPE`` field, a mismatch between the two values leads to a :class:`ValueError`. The field types of matching fields are checked. If the field type on the incoming XSO may not be upcast to the field type declared on the form (see :meth:`~.FieldType.allow_upcast`), a :class:`ValueError` is raised. If the :attr:`~.Data.type_` does not indicate an actual form (but rather a cancellation request or tabular result), :class:`ValueError` is raised. """


        my_form_type = getattr(self, "FORM_TYPE", None)

        f = self()
        for field in xso.fields:
            if field.var == "FORM_TYPE":
                if (my_form_type is not None and
                        field.type_ == forms_xso.FieldType.HIDDEN and
                        field.values):
                    if my_form_type != field.values[0]:
                        raise ValueError(
                            "mismatching FORM_TYPE ({!r} != {!r})".format(
                                field.values[0],
                                my_form_type,
                            )
                        )
                continue
            if field.var is None:
                continue

            key = fields.descriptor_ns, field.var
            try:
                descriptor = self.DESCRIPTOR_MAP[key]
            except KeyError:
                continue

            if (field.type_ is not None and not
                    field.type_.allow_upcast(descriptor.FIELD_TYPE)):
                raise ValueError(
                    "mismatching type ({!r} != {!r}) on field var={!r}".format(
                        field.type_,
                        descriptor.FIELD_TYPE,
                        field.var,
                    )
                )

            data = descriptor.__get__(f, self)
            data.load(field)

        f._recv_xso = xso

        return f