def bool_int(value):
 if isinstance(value, basestring):
  if (value.lower() in ('', '0', 'false', 'f', 'no', 'n', 'off')):
   value = 0
 return int(bool(value))

def bool_int ( value ) : if isinstance ( value , basestring ) : if ( value . lower ( ) in ( '' , '0' , 'false' , 'f' , 'no' , 'n' , 'off' ) ) : value = 0 return int ( bool ( value ) )
casts a config value into a 0 or 1 .