code: def var_to_xml(val, name, trim_if_too_big=True, additional_in_xml='', evaluate_full_value=True):
      
  
      type_name, type_qualifier, is_exception_on_eval, resolver, value = get_variable_details(
          val, evaluate_full_value)
  
      try:
          name = quote(name, '/>_= ')  # TODO: Fix PY-5834 without using quote
      except:
          pass
  
      xml = '<var name="%s" type="%s" ' % (make_valid_xml_value(name), make_valid_xml_value(type_name))
  
      if type_qualifier:
          xml_qualifier = 'qualifier="%s"' % make_valid_xml_value(type_qualifier)
      else:
          xml_qualifier = ''
  
      if value:
          # cannot be too big... communication may not handle it.
          if len(value) > MAXIMUM_VARIABLE_REPRESENTATION_SIZE and trim_if_too_big:
              value = value[0:MAXIMUM_VARIABLE_REPRESENTATION_SIZE]
              value += '...'
  
          xml_value = ' value="%s"' % (make_valid_xml_value(quote(value, '/>_= ')))
      else:
          xml_value = ''
  
      if is_exception_on_eval:
          xml_container = ' isErrorOnEval="True"'
      else:
          if resolver is not None:
              xml_container = ' isContainer="True"'
          else:
              xml_container = ''
  
      return ''.join((xml, xml_qualifier, xml_value, xml_container, additional_in_xml, ' />\n'))
docs: single variable or dictionary to xml representation