def __iter__(self):
        """
        Return an iterator which will raise an exception as soon as C{next} is
        called on it.
        """
        class BadIterator(object):
            def next(self):
                raise RuntimeError("This is a really bad case.")
        return BadIterator()

        Return an iterator which will raise an exception as soon as C{next} is
        called on it.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/test/test_sendmsg.py