def METHOD_NAME(cls, event):
    """Used as callback in :meth:`BaseEnvironment.run()` to stop the
    simulation when the *until* event occurred."""
    if event.ok:
        raise cls(event.value)
    else:
        raise event.value