code: def presence_handler(type_, from_):
      
  
      def decorator(f):
          if asyncio.iscoroutinefunction(f):
              raise TypeError(
                  "presence_handler must not be a coroutine function"
              )
  
          aioxmpp.service.add_handler_spec(
              f,
              aioxmpp.service.HandlerSpec(
                  (_apply_presence_handler, (type_, from_)),
                  require_deps=(
                      SimplePresenceDispatcher,
                  )
              )
          )
          return f
      return decorator
docs: Register the decorated function as presence stanza handler.
  
      :param type_: Presence type to listen for
      :type type_: :class:`~.PresenceType`
      :param from_: Sender JIDs to listen for
      :type from_: :class:`aioxmpp.JID` or :data:`None`
      :raise TypeError: if the decorated object is a coroutine function
  
      .. seealso::
  
         :meth:`~.StanzaStream.register_presence_callback`
            for more details on the `type_` and `from_` arguments
  
      .. versionchanged:: 0.9
  
         This is now based on
         :class:`aioxmpp.dispatcher.SimplePresenceDispatcher`.