'Creates an xml fragment from the specified data.
data: Array of tuples, where first: xml element name
second: xml element text
third: conversion function'

@staticmethod
def data_to_xml(data, xml=None):

    for element in data:
        name = element[0]
        val = element[1]
        if (len(element) > 2):
            converter = element[2]
        else:
            converter = None
        if (val is not None):
            if (converter is not None):
                text = _str(converter(_str(val)))
            else:
                text = _str(val)
            entry = ET.Element(name)
            entry.text = text
            if (xml is not None):
                xml.append(entry)
            else:
                return entry
    return xml
