def add_element(self, element):
        """Add a new TocElement to the TOC container."""
        try:
            self.toc[element.group][element.name] = element
        except KeyError:
            self.toc[element.group] = {}
            self.toc[element.group][element.name] = element
def add_element ( self , element ) : try : self . toc [ element . group ] [ element . name ] = element except KeyError : self . toc [ element . group ] = { } self . toc [ element . group ] [ element . name ] = element
Add a new TocElement to the TOC container.