def METHOD_NAME(cls, token):
    # decode the token to ensure it minimally has view scope.
    # if it doesn't raise an error, the client will not be useful without it.
    # if for any reason we are not able to decode the token and check its scopes
    # we do NOT raise an error. this is to accommodate the possibility of a changed
    # token format some day that this version of the client may still be able to
    # pass as a bearer token.
    try:
        token_body = json.loads(
            str(
                base64.urlsafe_b64decode(
                    # we add padding to ensure that lack of padding won't prevent a decode error.
                    # the python base64 implementation will truncate extra padding so we can overpad
                    # rather than compute exactly how much padding we might need.
                    # https://stackoverflow.com/a/49459036
                    token.split(".")[1]
                    + "==="
                ),
                "utf-8",
            )
        )
        scopes = token_body.get("access", {}).get("scope")
        if scopes is not None and "view" not in scopes:
            raise SynapseAuthenticationError("A view scoped token is required")
    except (IndexError, ValueError):
        # possible errors if token is not encoded as expected:
        # IndexError if the token is not a '.' delimited base64 string with a header and body
        # ValueError if the split string is not base64 encoded or if the decoded base64 is not json
        pass