def chk(condition, message='Check failed', exc=RuntimeError):
    """Check a condition, raise an exception if bool(condition)==False, else return `condition`."""
    if not condition:
        raise exc(message)
    return condition