def _cast_none(x):
 if (isinstance(x, six.string_types) and (x == NONE_MAGIC_VALUE)):
  return None
 return x

def _cast_none ( x ) : if ( isinstance ( x , six . string_types ) and ( x == NONE_MAGIC_VALUE ) ) : return None return x
cast function which serializes special magic string value which indicate "none" to none type .