code: def subscribe_and_validate(self, topic, qos, payload, timeout=1):
          
          seconds = convert_time(timeout)
          self._verified = False
  
          logger.info('Subscribing to topic: %s' % topic)
          self._mqttc.subscribe(str(topic), int(qos))
          self._payload = str(payload)
          self._mqttc.on_message = self._on_message
  
          timer_start = time.time()
          while time.time() < timer_start + seconds:
              if self._verified:
                  break
              self._mqttc.loop()
  
          if not self._verified:
              raise AssertionError("The expected payload didn't arrive in the topic")
docs: Subscribe to a topic and validate that the specified payload is
          received within timeout. It is required that a connection has been
          established using `Connect` keyword. The payload can be specified as
          a python regular expression. If the specified payload is not received
          within timeout, an AssertionError is thrown.
  
          `topic` topic to subscribe to
  
          `qos` quality of service for the subscription
  
          `payload` payload (message) that is expected to arrive
  
          `timeout` time to wait for the payload to arrive
  
          Examples:
  
          | Subscribe And Validate | test/test | 1 | test message |