docs: def sign_encrypt(self, session_info, client_id, code=None,
                       access_token=None, user_info=None, sign=True,
                       encrypt=False, extra_claims=None):
          """
          Signed and or encrypt a IDToken
  
          :param session_info: Session information
          :param client_id: Client ID
          :param code: Access grant
          :param access_token: Access Token
          :param user_info: User information
          :param sign: If the JWT should be signed
          :param encrypt: If the JWT should be encrypted
          :param extra_claims: Extra claims to be added to the ID Token
          :return: IDToken as a signed and/or encrypted JWT
          """
  
          _cntx = self.endpoint_context
  
          client_info = _cntx.cdb[client_id]
          alg_dict = get_sign_and_encrypt_algorithms(_cntx, client_info,
                                                     'id_token', sign=sign,
                                                     encrypt=encrypt)
  
          _authn_event = session_info['authn_event']
  
          _idt_info = self.payload(session_info,
                                   acr=_authn_event["authn_info"],
                                   alg=alg_dict['sign_alg'], code=code,
                                   access_token=access_token, user_info=user_info,
                                   auth_time=_authn_event["authn_time"],
                                   extra_claims=extra_claims)
  
          _jwt = JWT(_cntx.keyjar, iss=_cntx.issuer,
                     lifetime=_idt_info['lifetime'], **alg_dict)
  
          return _jwt.pack(_idt_info['payload'], recv=client_id)