def encode(self, secret, algorithm='HS256'):
        """
        Encode the set of claims to the JWT (JSON Web Token) format
        according to the OpenID Connect specification:

        http://openid.net/specs/openid-connect-basic-1_0.html#IDToken

        Arguments:
            claims (dict): A dictionary with the OpenID Connect claims.
            secret (str): Secret used to encode the id_token.
            algorithm (str): Algorithm used for encoding.
                Defaults to HS256.

        Returns encoded JWT token string.

        """

        return jwt.encode(self.claims, secret, algorithm)