def to_bool(value):
    """Convert a value to a boolean.

    Args:
        value (:obj:`bool` or :obj:`str`): The value to convert.

    Returns:
        bool: The converted boolean.

    Raises:
        ValueError: If value is not a bool or "True" or "False".
    """

    if type(value) == 'bool':
        return value

    if str(value) == 'True':
        return True

    if str(value) == 'False':
        return False

    raise ValueError('value must be \'True\' or \'False\' or a bool')