def _check_boolean(input, name):
    """Exception raising if input is not a boolean

    Checks whether input is not ``None`` and if not checks that the input is a
    boolean.

    Parameters
    ----------
    input: any
        The input parameter to be checked
    name: str
        The name of the variable for printing explicit errors in ``Exception``

    Returns
    -------
    bool
        Returns the input if all checks pass

    Raises
    ------
    ValueError
        If input is None
    TypeError
        If input does not have correct type
    """
    if input is None:
        raise ValueError(f"`{name}` is None")
    if not ((input is True) or (input is False)):
        raise TypeError(f"`{name}` must be type {bool} but is " +
                        f"{type(input)}")
    return input