<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_presence(self, state, status={}, priority=0):
 """ Change the presence broadcast by the client. :param state: New presence state to broadcast :type state: :class:`aioxmpp.PresenceState` :param status: New status information to broadcast :type status: :class:`dict` or :class:`str` :param priority: New priority for the resource :type priority: :class:`int` :return: Stanza token of the presence stanza or :data:`None` if the presence is unchanged or the stream is not connected. :rtype: :class:`~.stream.StanzaToken` If the client is currently connected, the new presence is broadcast immediately. `status` must be either a string or something which can be passed to the :class:`dict` constructor. If it is a string, it is wrapped into a dict using ``{None: status}``. The mapping must map :class:`~.LanguageTag` objects (or :data:`None`) to strings. The information will be used to generate internationalised presence status information. If you do not need internationalisation, simply use the string version of the argument. """


        if not isinstance(priority, numbers.Integral):
            raise TypeError(
                "invalid priority: got {}, expected integer".format(
                    type(priority)
                )
            )

        if not isinstance(state, aioxmpp.PresenceState):
            raise TypeError(
                "invalid state: got {}, expected aioxmpp.PresenceState".format(
                    type(state),
                )
            )

        if isinstance(status, str):
            new_status = {None: status}
        else:
            new_status = dict(status)
        new_priority = int(priority)

        emit_state_event = self._state != state
        emit_overall_event = (
            emit_state_event or
            self._priority != new_priority or
            self._status != new_status
        )

        self._state = state
        self._status = new_status
        self._priority = new_priority

        if emit_state_event:
            self.on_presence_state_changed()
        if emit_overall_event:
            self.on_presence_changed()
            return self.resend_presence()