code: def jwk_wrap(key, use="", kid=""):
      
      if isinstance(key, rsa.RSAPublicKey) or isinstance(key, rsa.RSAPrivateKey):
          kspec = RSAKey(use=use, kid=kid).load_key(key)
      elif isinstance(key, str):
          kspec = SYMKey(key=key, use=use, kid=kid)
      elif isinstance(key, ec.EllipticCurvePublicKey):
          kspec = ECKey(use=use, kid=kid).load_key(key)
      else:
          raise Exception("Unknown key type:key=" + str(type(key)))
  
      kspec.serialize()
      return kspec
docs: Instantiate a Key instance with the given key
  
      :param key: The keys to wrap
      :param use: What the key are expected to be use for
      :param kid: A key id
      :return: The Key instance