code: def message_callback_add(self, sub, callback):
          
          if callback is None or sub is None:
              raise ValueError("sub and callback must both be defined.")
  
          self._callback_mutex.acquire()
          for i in range(0, len(self.on_message_filtered)):
              if self.on_message_filtered[i][0] == sub:
                  self.on_message_filtered[i] = (sub, callback)
                  self._callback_mutex.release()
                  return
  
          self.on_message_filtered.append((sub, callback))
          self._callback_mutex.release()
docs: Register a message callback for a specific topic.
          Messages that match 'sub' will be passed to 'callback'. Any
          non-matching messages will be passed to the default on_message
          callback.
          
          Call multiple times with different 'sub' to define multiple topic
          specific callbacks.
          
          Topic specific callbacks may be removed with
          message_callback_remove().