docs: def reset_state(self):
          """Reset the runtime state after processing a message to either idle
          or shutting down based upon the current state.
  
          """
          self.active_message = None
          self.measurement = None
          if self.is_waiting_to_shutdown:
              self.shutdown_connections()
          elif self.is_processing:
              self.set_state(self.STATE_IDLE)
          elif self.is_idle or self.is_connecting or self.is_shutting_down:
              pass
          else:
              LOGGER.critical('Unexepected state: %s', self.state_description)
          LOGGER.debug('State reset to %s (%s in pending)',
                       self.state_description, len(self.pending))