def guess_field_type(field):
 if isinstance(field, TranslatedFieldsField):
  return 'object'
 elif isinstance(field, EnumField):
  types = Counter([type(x) for x in field.choices])
  most_common = types.most_common(1)[0][0]
  if ((most_common in six.string_types) or (most_common == six.text_type)):
   return 'string'
  elif (most_common in six.integer_types):
   return 'number'
  elif (most_common == bool):
   return 'boolean'
 return types_lookup[field]

def guess_field_type ( field ) : if isinstance ( field , TranslatedFieldsField ) : return 'object' elif isinstance ( field , EnumField ) : types = Counter ( [ type ( x ) for x in field . choices ] ) most_common = types . most_common ( 1 ) [ 0 ] [ 0 ] if ( ( most_common in six . string_types ) or ( most_common == six . text_type ) ) : return 'string' elif ( most_common in six . integer_types ) : return 'number' elif ( most_common == bool ) : return 'boolean' return types_lookup [ field ]
tries to guess the field type .