code: def ecdh(self, identity, pubkey):
          
          assert pubkey[:1] == b'\x04'
          peer = ecdsa.VerifyingKey.from_string(
              pubkey[1:],
              curve=ecdsa.curves.NIST256p,
              hashfunc=hashlib.sha256)
          shared = ecdsa.VerifyingKey.from_public_point(
              point=(peer.pubkey.point * self.secexp),
              curve=ecdsa.curves.NIST256p,
              hashfunc=hashlib.sha256)
          return shared.to_string()
docs: Get shared session key using Elliptic Curve Diffie-Hellman.