def fdopen(self, fd, flag):
        """
        Fake C{os.fdopen}. Return a file-like object whose content can
        be tested later via C{self.fdio}.
        """
        if flag == "wb":
            self.fdio = BytesIO()
        else:
            assert False
        return self.fdio

        Fake C{os.fdopen}. Return a file-like object whose content can
        be tested later via C{self.fdio}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_process.py