def bool_or_fail(v):
    """ A special variant of :code:`bool` that raises :code:`ValueError`s
    if the provided value was not :code:`True` or :code:`False`.

    This prevents overeager casting like :code:`bool("bla") -> True`

    Parameters
    ----------
    v : mixed
        Value to be cast

    Returns
    -------
    b : boolean
        The result of the cast

    """
    try:
        if v.lower() == 'true':
            return True
        elif v.lower() == 'false':
            return True
    except Exception:
        pass
    raise ValueError()