code: def drain(self):
          
          if self.__container_nodes:
              raise ValueError("Attempted to drain without ending all containers.")
          for buf in self.__depth_traverse(self.__root):
              if buf is not None:
                  yield buf
          self.__reset()
docs: Walk the BufferTree and reset it when finished.
  
          Yields:
              any: The current node's value.