code: def from_events(self, instance, ev_args, ctx):
          
  
          # goal: collect all elements starting with the element for which we got
          # the start-ev_args in a lxml.etree.Element.
  
          def make_from_args(ev_args, parent):
              el = etree.SubElement(parent,
                                    tag_to_str((ev_args[0], ev_args[1])))
              for key, value in ev_args[2].items():
                  el.set(tag_to_str(key), value)
              return el
  
          root_el = make_from_args(ev_args,
                                   self.__get__(instance, type(instance)))
          # create an element stack
          stack = [root_el]
          while stack:
              # we get send all sax-ish events until we return. we return when
              # the stack is empty, i.e. when our top element ended.
              ev_type, *ev_args = yield
              if ev_type == "start":
                  # new element started, create and push to stack
                  stack.append(make_from_args(ev_args, stack[-1]))
              elif ev_type == "text":
                  # text for current element
                  curr = stack[-1]
                  if curr.text is not None:
                      curr.text += ev_args[0]
                  else:
                      curr.text = ev_args[0]
              elif ev_type == "end":
                  # element ended, remove from stack (it is already appended to
                  # the current element)
                  stack.pop()
              else:
                  # not in coverage -- this is more like an assertion
                  raise ValueError(ev_type)
docs: Collect the events and convert them to a single XML subtree, which then
          gets appended to the list at `instance`. `ev_args` must be the
          arguments of the ``"start"`` event of the new child.
  
          This method is suspendable.