<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_node(cls, node):
 """ Creates a new spade.message.Message from an aixoxmpp.stanza.Message Args: node (aioxmpp.stanza.Message):
 an aioxmpp Message Returns: spade.message.Message: a new spade Message """

        if not isinstance(node, aioxmpp.stanza.Message):
            raise AttributeError("node must be a aioxmpp.stanza.Message instance")
        msg = cls()
        msg._to = node.to
        msg._sender = node.from_
        if None in node.body:
            msg.body = node.body[None]
        else:
            for key in node.body.keys():
                msg.body = node.body[key]
                break

        for data in node.xep0004_data:
            if data.title == SPADE_X_METADATA:
                for field in data.fields:
                    if field.var != "_thread_node":
                        msg.set_metadata(field.var, field.values[0])
                    else:
                        msg.thread = field.values[0]

        return msg