def to_bool(input, default=False):
 if (input is None):
  value = default
 else:
  int_value = to_int(input, default=None)
  if (int_value is None):
   value = default
  else:
   value = bool(int_value)
 return value

def to_bool ( input , default = False ) : if ( input is None ) : value = default else : int_value = to_int ( input , default = None ) if ( int_value is None ) : value = default else : value = bool ( int_value ) return value
convert a value to boolean .