code: def encrypt(self, keys=None, cek="", iv="", **kwargs):
          
  
          _alg = self["alg"]
  
          # Find Usable Keys
          if keys:
              keys = self.pick_keys(keys, use="enc")
          else:
              keys = self.pick_keys(self._get_keys(), use="enc")
  
          if not keys:
              logger.error(KEY_ERR.format(_alg))
              raise NoSuitableEncryptionKey(_alg)
  
          # Determine Encryption Class by Algorithm
          if _alg in ["RSA-OAEP", "RSA-OAEP-256", "RSA1_5"]:
              encrypter = JWE_RSA(self.msg, **self._dict)
          elif _alg.startswith("A") and _alg.endswith("KW"):
              encrypter = JWE_SYM(self.msg, **self._dict)
          else:  # _alg.startswith("ECDH-ES"):
              encrypter = JWE_EC(**self._dict)
              cek, encrypted_key, iv, params, eprivk = encrypter.enc_setup(
                  self.msg, key=keys[0], **self._dict)
              kwargs["encrypted_key"] = encrypted_key
              kwargs["params"] = params
  
          if cek:
              kwargs["cek"] = cek
  
          if iv:
              kwargs["iv"] = iv
  
          for key in keys:
              if isinstance(key, SYMKey):
                  _key = key.key
              elif isinstance(key, ECKey):
                  _key = key.public_key()
              else:  # isinstance(key, RSAKey):
                  _key = key.public_key()
  
              if key.kid:
                  encrypter["kid"] = key.kid
  
              try:
                  token = encrypter.encrypt(key=_key, **kwargs)
                  self["cek"] = encrypter.cek if 'cek' in encrypter else None
              except TypeError as err:
                  raise err
              else:
                  logger.debug(
                      "Encrypted message using key with kid={}".format(key.kid))
                  return token
docs: Encrypt a payload
  
          :param keys: A set of possibly usable keys
          :param cek: Content master key
          :param iv: Initialization vector
          :param kwargs: Extra key word arguments
          :return: Encrypted message