<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def invite(self, address, text=None, *, mode=InviteMode.DIRECT, allow_upgrade=False):
 """ Invite another entity to the conversation. :param address: The address of the entity to invite. :type address: :class:`aioxmpp.JID` :param text: A reason/accompanying text for the invitation. :param mode: The invitation mode to use. :type mode: :class:`~.im.InviteMode` :param allow_upgrade: Whether to allow creating a new conversation to satisfy the invitation. :type allow_upgrade: :class:`bool` :raises NotImplementedError: if the requested `mode` is not supported :raises ValueError: if `allow_upgrade` is false, but a new conversation is required. :return: The stanza token for the invitation and the possibly new conversation object :rtype: tuple of :class:`~.StanzaToken` and :class:`~.AbstractConversation` .. note:: Even though this is a coroutine, it returns a stanza token. The coroutine-ness may be needed to generate the invitation in the first place. Sending the actual invitation is done non-blockingly and the stanza token for that is returned. To wait until the invitation has been sent, unpack the stanza token from the result and await it. Return the new conversation object to use. In many cases, this will simply be the current conversation object, but in some cases (e.g. when someone is invited to a one-on-one conversation), a new conversation must be created and used. If `allow_upgrade` is false and a new conversation would be needed to invite an entity, :class:`ValueError` is raised. Additional features: :attr:`~.ConversationFeature.INVITE_DIRECT` Support for :attr:`~.im.InviteMode.DIRECT` mode. :attr:`~.ConversationFeature.INVITE_DIRECT_CONFIGURE` If a direct invitation is used, the conversation will be configured to allow the invitee to join before the invitation is sent. This may fail with a :class:`aioxmpp.errors.XMPPError`, in which case the error is re-raised and the invitation not sent. :attr:`~.ConversationFeature.INVITE_MEDIATED` Support for :attr:`~.im.InviteMode.MEDIATED` mode. :attr:`~.ConversationFeature.INVITE_UPGRADE` If `allow_upgrade` is :data:`True`, an upgrade will be performed and a new conversation is returned. If `allow_upgrade` is :data:`False`, the invite will fail. .. seealso:: The corresponding feature for this method is :attr:`.ConversationFeature.INVITE`. See :attr:`features` for details on the semantics of features. """

        raise self._not_implemented_error("inviting entities")