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 __HOLE__:
                break
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/codec.py/Encoder.writeGenerator