code: def load_terms(self, terms):
          
  
          #if self.root and len(self.root.children) > 0:
          #    raise MetatabError("Can't run after adding terms to document.")
  
          for t in terms:
  
              t.doc = self
  
              if t.term_is('root.root'):
                  if not self.root:
                      self.root = t
                      self.add_section(t)
  
                  continue
  
              if t.term_is('root.section'):
                  self.add_section(t)
  
              elif t.parent_term_lc == 'root':
                  self.add_term(t)
  
              else:
                  # These terms aren't added to the doc because they are attached to a
                  # parent term that is added to the doc.
                  assert t.parent is not None
  
  
          try:
              dd = terms.declare_dict
  
              self.decl_terms.update(dd['terms'])
              self.decl_sections.update(dd['sections'])
  
              self.super_terms.update(terms.super_terms())
  
              kf = lambda e: e[1]  # Sort on the value
              self.derived_terms ={ k:set( e[0] for e in g)
                                    for k, g in groupby(sorted(self.super_terms.items(), key=kf), kf)}
  
          except AttributeError as e:
              pass
  
          try:
              self.errors = terms.errors_as_dict()
          except AttributeError:
              self.errors = {}
  
          return self
docs: Create a builder from a sequence of terms, usually a TermInterpreter