code: def config_xml_to_dict(contents, result, parse_job=True):
      
      from lxml import etree
      try:
          root = etree.fromstring(contents)
          pairs = []
          if parse_job:
              # parse job
              for elem in root:
                  if (elem.tag != gc.CONFIG_XML_TASKS_TAG) and (elem.text is not None):
                      pairs.append(u"%s%s%s" % (
                          safe_unicode(elem.tag),
                          gc.CONFIG_STRING_ASSIGNMENT_SYMBOL,
                          safe_unicode(elem.text.strip())
                      ))
              return pairs_to_dict(pairs)
          else:
              # parse tasks
              output_list = []
              for task in root.find(gc.CONFIG_XML_TASKS_TAG):
                  if task.tag == gc.CONFIG_XML_TASK_TAG:
                      pairs = []
                      for elem in task:
                          if elem.text is not None:
                              pairs.append(u"%s%s%s" % (
                                  safe_unicode(elem.tag),
                                  gc.CONFIG_STRING_ASSIGNMENT_SYMBOL,
                                  safe_unicode(elem.text.strip())
                              ))
                      output_list.append(pairs_to_dict(pairs))
              return output_list
      except:
          if result is not None:
              result.passed = False
              result.add_error("An error occurred while parsing XML file")
          if parse_job:
              return {}
          else:
              return []
docs: Convert the contents of a XML config file
      into the corresponding dictionary ::
  
          dictionary[key_1] = value_1
          dictionary[key_2] = value_2
          ...
          dictionary[key_n] = value_n
  
      :param bytes contents: the XML configuration contents
      :param bool parse_job: if ``True``, parse the job properties;
                             if ``False``, parse the tasks properties
      :rtype: dict (``parse_job=True``) or list of dict (``parse_job=False``)