def native_value(value):
 if isinstance(value, six.string_types):
  if (value.lower() in ['on', 'true', 'yes']):
   value = True
  elif (value.lower() in ['off', 'false', 'no']):
   value = False
  try:
   return ast.literal_eval(value)
  except (TypeError, ValueError, SyntaxError):
   pass
 return value

def native_value ( value ) : if isinstance ( value , six . string_types ) : if ( value . lower ( ) in [ 'on' , 'true' , 'yes' ] ) : value = True elif ( value . lower ( ) in [ 'off' , 'false' , 'no' ] ) : value = False try : return ast . literal_eval ( value ) except ( TypeError , ValueError , SyntaxError ) : pass return value
convert string value to native python values .