def setUp(self):
        """
        Patch C{sys.stdout} so tests can make assertions about what's printed.
        """
        if _PY3:
            self.stdout = StringIO()
        else:
            self.stdout = BytesIO()
        self.patch(sys, 'stdout', self.stdout)

        Patch C{sys.stdout} so tests can make assertions about what's printed.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_ckeygen.py