code: def _process_incoming(self, xmlstream, queue_entry):
          
  
          stanza_obj, exc = queue_entry
  
          # first, handle SM stream objects
          if isinstance(stanza_obj, nonza.SMAcknowledgement):
              self._logger.debug("received SM ack: %r", stanza_obj)
              if not self._sm_enabled:
                  self._logger.warning("received SM ack, but SM not enabled")
                  return
              self.sm_ack(stanza_obj.counter)
              return
          elif isinstance(stanza_obj, nonza.SMRequest):
              self._logger.debug("received SM request: %r", stanza_obj)
              if not self._sm_enabled:
                  self._logger.warning("received SM request, but SM not enabled")
                  return
              response = nonza.SMAcknowledgement()
              response.counter = self._sm_inbound_ctr
              self._logger.debug("sending SM ack: %r", response)
              xmlstream.send_xso(response)
              return
  
          # raise if it is not a stanza
          if not isinstance(stanza_obj, stanza.StanzaBase):
              raise RuntimeError(
                  "unexpected stanza class: {}".format(stanza_obj))
  
          # now handle stanzas, these always increment the SM counter
          if self._sm_enabled:
              self._sm_inbound_ctr += 1
              self._sm_inbound_ctr &= 0xffffffff
  
          # check if the stanza has errors
          if exc is not None:
              self._process_incoming_erroneous_stanza(stanza_obj, exc)
              return
  
          if isinstance(stanza_obj, stanza.IQ):
              self._process_incoming_iq(stanza_obj)
          elif isinstance(stanza_obj, stanza.Message):
              self._process_incoming_message(stanza_obj)
          elif isinstance(stanza_obj, stanza.Presence):
              self._process_incoming_presence(stanza_obj)
docs: Dispatch to the different methods responsible for the different stanza
          types or handle a non-stanza stream-level element from `stanza_obj`,
          which has arrived over the given `xmlstream`.