code: def request_object_encryption(msg, service_context, **kwargs):
      
      try:
          encalg = kwargs["request_object_encryption_alg"]
      except KeyError:
          try:
              encalg = service_context.behaviour["request_object_encryption_alg"]
          except KeyError:
              return msg
  
      if not encalg:
          return msg
  
      try:
          encenc = kwargs["request_object_encryption_enc"]
      except KeyError:
          try:
              encenc = service_context.behaviour["request_object_encryption_enc"]
          except KeyError:
              raise MissingRequiredAttribute(
                  "No request_object_encryption_enc specified")
  
      if not encenc:
          raise MissingRequiredAttribute(
              "No request_object_encryption_enc specified")
  
      _jwe = JWE(msg, alg=encalg, enc=encenc)
      _kty = alg2keytype(encalg)
  
      try:
          _kid = kwargs["enc_kid"]
      except KeyError:
          _kid = ""
  
      if "target" not in kwargs:
          raise MissingRequiredAttribute("No target specified")
  
      if _kid:
          _keys = service_context.keyjar.get_encrypt_key(_kty,
                                                         owner=kwargs["target"],
                                                         kid=_kid)
          _jwe["kid"] = _kid
      else:
          _keys = service_context.keyjar.get_encrypt_key(_kty,
                                                         owner=kwargs["target"])
  
      return _jwe.encrypt(_keys)
docs: Created an encrypted JSON Web token with *msg* as body.
  
      :param msg: The mesaqg
      :param service_context:
      :param kwargs:
      :return: