def bool_value(value):
    """
    Converts the given object to a bool if it is possible.

    Parameters
    ----------
    value : object
        Object to be converted to bool.

    Returns
    -------
    value : bool
        Bool value.

    Raises
    ------
    ValueError
        If the object cannot be converted to bool.
    """
    if isinstance(value, bool):
        return value
    if hasattr(value, 'render'):
        value = value.render()
    if value in ['true', '1']:
        return True
    elif value in ['false', '0']:
        return False
    raise ValueError('Invalid bool value: {!r}'.format(value))
