code: def ping(client, peer):
      
  
      iq = aioxmpp.IQ(
          to=peer,
          type_=aioxmpp.IQType.GET,
          payload=ping_xso.Ping()
      )
  
      yield from client.send(iq)
docs: Ping a peer.
  
      :param peer: The peer to ping.
      :type peer: :class:`aioxmpp.JID`
      :raises aioxmpp.errors.XMPPError: as received
  
      Send a :xep:`199` ping IQ to `peer` and wait for the reply.
  
      This is a low-level version of :meth:`aioxmpp.PingService.ping`.
  
      **When to use this function vs. the service method:** See
      :meth:`aioxmpp.PingService.ping`.
  
      .. note::
  
          If the peer does not support :xep:`199`, they will respond with
          a ``cancel`` ``service-unavailable`` error. However, some
          implementations return a ``cancel`` ``feature-not-implemented``
          error instead. Callers should be prepared for the
          :class:`aioxmpp.XMPPCancelError` exceptions in those cases.
  
      .. versionchanged:: 0.11
  
          Extracted this helper from :class:`aioxmpp.PingService`.