def setboolean(obj, attr, _bool=None):
 if (_bool is None):
  _bool = dict(_boolean_states)
 res = _bool[getattr(obj, attr).lower()]
 setattr(obj, attr, res)
 return res

def setboolean ( obj , attr , _bool = None ) : if ( _bool is None ) : _bool = dict ( _boolean_states ) res = _bool [ getattr ( obj , attr ) . lower ( ) ] setattr ( obj , attr , res ) return res
replace the attribute with a boolean .