def connect(self, protocolFactory):
        """
        Connect the given protocol factory and unwrap its result.
        """
        return self._wrappedEndpoint.connect(
            self._wrapperFactory(protocolFactory)
        ).addCallback(lambda protocol: protocol.wrappedProtocol)

        Connect the given protocol factory and unwrap its result.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/endpoints.py