code: def subscribe(self, topic, callback, ordered=True):
          
  
          if '+' in topic or '#' in topic:
              regex = re.compile(topic.replace('+', '[^/]+').replace('#', '.*'))
              self.wildcard_queues.append((topic, regex, callback, ordered))
          else:
              self.queues[topic] = PacketQueue(0, callback, ordered)
  
          try:
              self.client.subscribe(topic, 1, self._on_receive)
          except operationError as exc:
              raise InternalError("Could not subscribe to topic", topic=topic, message=exc.message)
docs: Subscribe to future messages in the given topic
  
          The contents of topic should be in the format created by self.publish with a
          sequence number of message type encoded as a json string.
  
          Wildcard topics containing + and # are allowed and
  
          Args:
              topic (string): The MQTT topic to subscribe to
              callback (callable): The callback to call when a new mesage is received
                  The signature of callback should be callback(sequence, topic, type, message)
              ordered (bool): Whether messages on this topic have a sequence number that must
                  be checked and queued to ensure that packets are received in order