code: def tree_iterator(self, visited=None, path=None):
          '''
          Generator function that traverse the dr tree start from this node (self).
          '''
          if visited is None:
              visited = set()
  
          if self not in visited:
              if path and isinstance(path, list):
                  path.append(self)
  
              visited.add(self)
              yield self
  
              if not hasattr(self, 'dterms'):
                  yield
  
              for dterm in self.dterms:
                  if hasattr(self, dterm):
                      child = getattr(self, dterm)
                      if hasattr(child, 'dterms') or hasattr(child, 'terms'):
                          for node in child.tree_iterator(visited):
                              yield nodf tree_iterator(self, visited=None, path=None):
          '''
          Generator function that traverse the dr tree start from this node (self).
          '''
          if visited is None:
              visited = set()
  
          if self not in visited:
              if path and isinstance(path, list):
                  path.append(self)
  
              visited.add(self)
              yield self
  
              if not hasattr(self, 'dterms'):
                  yield
  
              for dterm in self.dterms:
                  if hasattr(self, dterm):
                      child = getattr(self, dterm)
                      if hasattr(child, 'dterms') or hasattr(child, 'terms'):
                          for node in child.tree_iterator(visited):
                              yield node
docs: Generator function that traverse the dr tree start from this node (self).