def ensure_only_specificmessage_from_bot(self, match, wait=5, tosender=False):
        if tosender is True:
            match = six.text_type(r'^\<@{}\>: {}$').format(self.driver_userid, match)
        else:
            match = u'^{}$'.format(match)

        for _ in range(wait):
            time.sleep(1)
            with self._events_lock:
                for event in self.events:
                    if self._is_bot_message(event) and re.match(match, event['text'], re.DOTALL) is None:
                        raise AssertionError(
                            u'expected to get message matching "{}", but got message "{}"'.format(match, event['text']))
dataset/ETHPy150Open lins05/slackbot/tests/functional/driver.py/Driver.ensure_only_specificmessage_from_bot/original