(val)
A very dumb string to boolean converter.  Will fail hard
    if the conversion doesn't succeed.
A very dumb string to boolean converter.  Will fail hard
    if the conversion doesn't succeed.
A very dumb string to boolean converter . Will fail hard if the conversion doesn t succeed .
def string_to_boolean(val):
    """
    A very dumb string to boolean converter.  Will fail hard
    if the conversion doesn't succeed.
    """
    if val is None: return False
    if isinstance(val, bool):
        return val
    if val.lower().strip() in TRUE_STRINGS:
        return True
    elif val.lower().strip() in FALSE_STRINGS:
        return False
    raise ValueError("%s is not a parseable boolean!" % val)
def string_to_boolean ( val ) : if val is None : return False if isinstance ( val , bool ) : return val if val . lower ( ) . strip ( ) in TRUE_STRINGS : return True elif val . lower ( ) . strip ( ) in FALSE_STRINGS : return False raise ValueError ( "%s is not a parseable boolean!" % val )