docs: def writeGenerator(self, gen):
          """
          Iterates over a generator object and encodes all that is returned.
          """
          n = getattr(gen, 'next')
  
          while True:
              try:
                  self.writeElement(n())
              except StopIteration:
                  break