Encode a JWT token based on the claims_set and the settings.

        If available, registry.settings.jwtauth.private_key is used as key.
        In this case the algorithm must be an RS* or EC* algorithm.
        If registry.settings.jwtauth.private_key is not set,
        registry.settings.jwtauth.master_secret is used.
        registry.settings.jwtauth.algorithm is used as algorithm.

        :param claims_set: set of claims, which will be included in
            the created token.

def encode_jwt(self, claims_set):
        """Encode a JWT token based on the claims_set and the settings.

        If available, registry.settings.jwtauth.private_key is used as key.
        In this case the algorithm must be an RS* or EC* algorithm.
        If registry.settings.jwtauth.private_key is not set,
        registry.settings.jwtauth.master_secret is used.
        registry.settings.jwtauth.algorithm is used as algorithm.

        :param claims_set: set of claims, which will be included in
            the created token.
        """
        token = jwt.encode(claims_set, self.private_key, self.algorithm)

        if PY3:
            token = token.decode(encoding='UTF-8')

        return token