def GetFieldValue(field):
 if (not field):
  return None
 value = field.value().string_value()
 value_type = field.value().type()
 if (value_type in TEXT_DOCUMENT_FIELD_TYPES):
  return value
 if (value_type == document_pb.FieldValue.DATE):
  return DeserializeDate(value)
 if (value_type == document_pb.FieldValue.NUMBER):
  return float(value)
 raise TypeError(('No conversion defined for type %s' % value_type))

def GetFieldValue ( field ) : if ( not field ) : return None value = field . value ( ) . string_value ( ) value_type = field . value ( ) . type ( ) if ( value_type in TEXT_DOCUMENT_FIELD_TYPES ) : return value if ( value_type == document_pb . FieldValue . DATE ) : return DeserializeDate ( value ) if ( value_type == document_pb . FieldValue . NUMBER ) : return float ( value ) raise TypeError ( ( 'No conversion defined for type %s' % value_type ) )
returns the value of a field as the correct type .