def run(self, notification, callback):
        """
        Run all the middleware in order, then call the callback.
        """

        # the last step in the notification stack is to call the callback.
        # we also do this inside the exception handler, so need to ensure that
        # the callback is only called once.
        def finish(notification):
            if not hasattr(finish, 'called'):
                finish.called = True
                callback()

        to_call = finish
        for middleware in reversed(self.stack):
            to_call = middleware(to_call)

        try:
            to_call(notification)
        except Exception as exc:
            template = "Error in exception middleware: %s\n%s"
            bugsnag.log((exc, traceback.format_exc()) % template)
            # still notify if middleware crashes before notification
            finish(notification)
dataset/ETHPy150Open bugsnag/bugsnag-python/bugsnag/middleware.py/MiddlewareStack.run/swapped operands of `%`