def _construct_section_tree(self):
        """
        For some weird reason Google Documents doesn't like nesting
        lists, so their table of contents requires a bunch of special
        formatting. Instead of trying to hack off what they provide
        us, we create a tree of sections based on each sections
        level. This tree will be used to construct the html for the
        table of contents.
        """
        self._section_tree = TreeNode(Section(level=0))
        current_node = self._section_tree
        for section in self._sections:
            while section['level'] <= current_node.value['level']:
                current_node = current_node.parent
            while current_node.value['level'] + 1 > section['level']:
                empty_section = Section(level=current_node.value['level'] + 1)
                current_node = current_node.add_child(empty_section)
            assert section['level'] == current_node.value['level'] + 1
            current_node = current_node.add_child(section)
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/apps/main/google_doc.py/GoogleDoc._construct_section_tree/swapped operands of `>`