<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_callback(self, type_, from_, cb, *, wildcard_resource=True):
 """ Register a callback function. :param type_: Stanza type to listen for, or :data:`None` for a wildcard match. :param from_: Sender to listen for, or :data:`None` for a full wildcard match. :type from_: :class:`aioxmpp.JID` or :data:`None` :param cb: Callback function to register :param wildcard_resource: Whether to wildcard the resourcepart of the JID. :type wildcard_resource: :class:`bool` :raises ValueError: if another function is already registered for the callback slot. `cb` will be called whenever a stanza with the matching `type_` and `from_` is processed. The following wildcarding rules apply: 1. If the :attr:`~aioxmpp.stanza.StanzaBase.from_` attribute of the stanza has a resourcepart, the following lookup order for callbacks is used: |``type_`` |``from_`` |``wildcard_resource`` | +===========================+==================================+======================+ |:attr:`~.StanzaBase.type_` |:attr:`~.StanzaBase.from_` |*any* | |:attr:`~.StanzaBase.type_` |*bare* :attr:`~.StanzaBase.from_` |:data:`True` | |:data:`None` |:attr:`~.StanzaBase.from_` |*any* | |:data:`None` |*bare* :attr:`~.StanzaBase.from_` |:data:`True` | |:attr:`~.StanzaBase.type_` |:data:`None` |*any* | |:data:`None` |:data:`None` |*any* | 2. If the :attr:`~aioxmpp.stanza.StanzaBase.from_` attribute of the stanza does *not* have a resourcepart, the following lookup order for callbacks is used: |``type_`` |``from_`` |``wildcard_resource`` | +===========================+===========================+======================+ |:attr:`~.StanzaBase.type_` |:attr:`~.StanzaBase.from_` |:data:`False` | |:data:`None` |:attr:`~.StanzaBase.from_` |:data:`False` | |:attr:`~.StanzaBase.type_` |:data:`None` |*any* | |:data:`None` |:data:`None` |*any* | Only the first callback which matches is called. `wildcard_resource` is ignored if `from_` is a full JID or :data:`None`. .. note:: When the server sends a stanza without from attribute, it is replaced with the bare :attr:`local_jid`, as per :rfc:`6120`. """
  # NOQA: E501
        if from_ is None or not from_.is_bare:
            wildcard_resource = False

        key = (type_, from_, wildcard_resource)
        if key in self._map:
            raise ValueError(
                "only one listener allowed per matcher"
            )

        self._map[type_, from_, wildcard_resource] = cb