def _render(self, parent, datum, patches, nsmap):

        # Allocate a node
        if callable(self.tag):
            tagname = self.tag(datum)
        else:
            tagname = self.tag

        if self.colon_ns:
            if ':' in tagname:
                if nsmap is None:
                    nsmap = {}
                colon_key, colon_name = tagname.split(':')
                nsmap[colon_key] = colon_key
                tagname = '{%s}%s' % (colon_key, colon_name)

        elem = etree.Element(tagname, nsmap=nsmap)

        # If we have a parent, append the node to the parent
        if parent is not None:
            parent.append(elem)

        # If the datum is None, do nothing else
        if datum is None:
            return elem

        # Apply this template element to the element
        self.apply(elem, datum)

        # Additionally, apply the patches
        for patch in patches:
            patch.apply(elem, datum)

        # We have fully rendered the element; return it
        return elem
Internal rendering.
dataset/ETHPy150Open openstack/rack/rack/api/xmlutil.py/TemplateElement._render