'Flushes a doc structure to a ReSTructed string
The document is flushed out in a DFS style where sections and their
subsections\' values are added to the string as they are visited.'

def flush_structure(self):

    if (len(self.path) == 1):
        if self.hrefs:
            self.style.new_paragraph()
            for (refname, link) in self.hrefs.items():
                self.style.link_target_definition(refname, link)
    value = self.getvalue()
    for (name, section) in self._structure.items():
        value += section.flush_structure()
    return value
