def _value_to_boolean(value):
    """Converts true-ish and false-ish values to boolean."""
    try:
        value = value.upper()
        if value in ['TRUE', 'T']:
            return True
        elif value in ['FALSE', 'F']:
            return False
    except AttributeError:
        pass
    try:
        value = int(value)
        return True if value == 1 else False
    except (TypeError, ValueError):
        pass
    raise ValueError('Cannot convert value {0} to boolean.'.format(value))
