def socket(self):
        """
        Create and return a new socket object, also tracking it so it can be
        closed in the test tear down.
        """
        s = socket.socket()
        self.openSockets.append(s)
        return s

        Create and return a new socket object, also tracking it so it can be
        closed in the test tear down.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_tcp_internals.py