def _startEphemeralDH(self):
        """
        Prepares for a Diffie-Hellman key agreement exchange.

        Creates an ephemeral keypair in the group defined by (self.g,
        self.p) and stores it.
        """

        numbers = dh.DHParameterNumbers(self.p, self.g)
        parameters = numbers.parameters(default_backend())
        self.dhSecretKey = parameters.generate_private_key()
        y = self.dhSecretKey.public_key().public_numbers().y
        self.dhSecretKeyPublicMP = MP(y)

        Prepares for a Diffie-Hellman key agreement exchange.

        Creates an ephemeral keypair in the group defined by (self.g,
        self.p) and stores it.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/transport.py