<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_es_value(obj, def_obj):
 """ Returns the value for an object that goes into the elacticsearch 'value' field args: obj: data object to update def_obj: the class instance that has defintion values """

    def get_dict_val(item):
        """
        Returns the string representation of the dict item
        """
        if isinstance(item, dict):
            return str(item.get('value'))
        return str(item)

    value_flds = []
    if def_obj.es_defs.get('kds_esValue'):
        value_flds = def_obj.es_defs['kds_esValue'].copy()
    else:
        # pdb.set_trace()
        value_flds = set(obj).difference(__ALL_IGN__)
        value_flds = list(value_flds)
    value_flds += __COMBINED__
    try:
        obj['value'] = [obj.get(label) for label in value_flds
                        if obj.get(label)][0]
    except IndexError:
        obj['value'] = ", ".join(["%s: %s" % (value.get('label'),
                                              value.get('value'))
                                  for prop, value in obj.items()
                                  if isinstance(value, dict) and \
                                  value.get('label')])

    if isinstance(obj['value'], list):
        obj['value'] = ", ".join([get_dict_val(item) for item in obj['value']])
    else:
        obj['value'] = get_dict_val(obj['value'])
    if str(obj['value']).strip().endswith("/"):
        obj['value'] = str(obj['value']).strip()[:-1].strip()
    if not obj['value']:
        obj['value'] = obj.get('uri', '')
    return obj