def _isbool ( string ) : return isinstance ( string , _bool_type ) or ( isinstance ( string , ( _binary_type , _text_type ) ) and string in ( "True" , "False" ) )
python boolean and or not
>>> _isbool ( True ) True >>> _isbool ( False ) True >>> _isbool ( 1 ) False
def _isbool(string):
    """
    >>> _isbool(True)
    True
    >>> _isbool("False")
    True
    >>> _isbool(1)
    False
    """
    return isinstance(string, _bool_type) or\
        (isinstance(string, (_binary_type, _text_type))
         and
         string in ("True", "False"))