def _do_user_info(self, token, **kwargs):
        try:
            _log_debug = kwargs["logger"].debug
        except KeyError:
            _log_debug = logger.debug

        _sdb = self.sdb
        # should be an access token
        typ, key = _sdb.access_token.type_and_key(token)
        _log_debug("access_token type: '%s'" % (typ,))

        try:
            assert typ == "T"
        except __HOLE__:
            raise FailedAuthentication("Wrong type of token")

        # _log_info("keys: %s" % self.sdb.keys())
        if _sdb.is_revoked(key):
            return self._error(error="access_denied", descr="Token is revoked")
        session = _sdb[key]

        # Scope can translate to userinfo_claims

        info = self.schema(**self._collect_user_info(session))

        # Should I return a JSON or a JWT ?
        _cinfo = self.cdb[session["client_id"]]
        try:
            if "userinfo_signed_response_alg" in _cinfo:
                # Will also encrypt if defined in cinfo
                jinfo = self.signed_userinfo(_cinfo, info, session)
                content_type = "application/jwt"
            elif "userinfo_encrypted_response_alg" in _cinfo:
                jinfo = info.to_json()
                jinfo = self.encrypt(jinfo, _cinfo, session["client_id"],
                                     "userinfo", "")
                content_type = "application/jwt"
            else:
                jinfo = info.to_json()
                content_type = "application/json"
        except NotSupportedAlgorithm as err:
            return self._error(error="access_denied",
                               descr="Not supported algorithm: {}".format(
                                   err.args[0]))
        except JWEException:
            return self._error(error="access_denied",
                               descr="Could not encrypt")

        return Response(jinfo, content=content_type)

    # noinspection PyUnusedLocal
dataset/ETHPy150Open rohe/pyoidc/src/oic/oic/provider.py/Provider._do_user_info