convert an RST tree (DGParentedTree -> lxml etree)

def gen_etree(self):
        """convert an RST tree (DGParentedTree -> lxml etree)"""
        relations_elem = self.gen_relations()
        header = E('header')
        header.append(relations_elem)

        self.gen_body()

        tree = E('rst')
        tree.append(header)

        # The <body> contains both <segment>, as well as <group> elements.
        # While the order of the elements should theoretically be irrelevant,
        # rs3 files usually list the segments before the groups.
        body = E('body')
        for segment in self.body['segments']:
            body.append(segment)
        for group in self.body['groups']:
            body.append(group)

        tree.append(body)
        return tree