code: def end_container(self, cancel=None):
          
          if not self._containers:
              return
          container = self._containers.pop()
          if len(self._containers) >= 1:
              parent = self._containers[-1]
          else:
              parent = self._doc.text
          if not cancel:
              parent.addElement(container)
docs: Finishes and registers the currently-active container, unless
          'cancel' is True.