def _is_expired_token_response(cls, response):
        """
        Determine whether the given response indicates that the token is expired.

        :param response: The response object.
        :return: True if the response indicates that the token is expired.
        """

        EXPIRED_MESSAGE = "Expired oauth2 access token"
        INVALID_MESSAGE = "Invalid oauth2 access token"

        if response.status_code == 400:
            try:
                body = response.json()
                if str(body.get('error_description')) in [EXPIRED_MESSAGE, INVALID_MESSAGE]:
                    return True
            except:
                pass
        return False
def _is_expired_token_response ( cls , response ) : EXPIRED_MESSAGE = "Expired oauth2 access token" INVALID_MESSAGE = "Invalid oauth2 access token" if response . status_code == 400 : try : body = response . json ( ) if str ( body . get ( 'error_description' ) ) in [ EXPIRED_MESSAGE , INVALID_MESSAGE ] : return True except : pass return False
Determine whether the given response indicates that the token is expired.

        :param response: The response object.
        :return: True if the response indicates that the token is expired.