def handle_exception(pred, f=lambda: None):
    """Handle the exception defined by `pred` by calling `f`.

    Default behavior is to simply ignore the matched exception.
    """
    try:
        yield
    except Exception as e:
        if pred(e):
            logger.debug("Handling exception %s", e)
            f()
        else:
            raise
Handle the exception defined by `pred` by calling `f`.

    Default behavior is to simply ignore the matched exception.
    
tapiriik/services/Smashrun/smashrun.py