def listener():
    """Return an instance of bus response tracker."""

    class Listner:  # pylint: disable=too-few-public-methods
        """Bus handler return value tracker."""

        responses = []

        def get_listener(self, channel, index):
            """Return an argument tracking listener."""

            def listener(arg=None):
                self.responses.append(msg % (index, channel, arg))

            return listener

    return Listner()
Return an instance of bus response tracker.
cherrypy/test/test_bus.py