def bool_attrib(element, attr):
 value = element.get(attr)
 if ((not value) or (value in ('false', 'f', '0'))):
  return False
 return True

def bool_attrib ( element , attr ) : value = element . get ( attr ) if ( ( not value ) or ( value in ( 'false' , 'f' , '0' ) ) ) : return False return True
cast an xml attribute that should be a boolean to a python equivalent none .