def boolean_validator(ns, value):
    """
    Boolean validator. Raises ValueError if input isn't a boolean string.

    :param pypsi.namespace.Namespace ns: active namespace
    :param value: input value
    :returns bool: validated value
    """
    if isinstance(value, bool):
        return value
    if isinstance(value, str):
        t = value.lower()
        if t in ('true', 't', '1', 'y', 'yes'):
            return True
        if t in ('false', 'f', '0', 'n', 'no'):
            return False
    raise ValueError('Value is not true or false')
