code: def toc(self):
          
          toc = []
          stack = [toc]
          for entry in self.__toc:
              entry['sub'] = []
              while entry['level'] < len(stack):
                  stack.pop()
              while entry['level'] > len(stack):
                  stack.append(stack[-1][-1]['sub'])
              stack[-1].append(entry)
          return toc
docs: Smart getter for Table of Content list.