def decode(self, token: Token, verify: bool = True) -> dict[str, Any]:
        """
        Performs a validation of the given token and returns its payload
        dictionary.

        Raises a `TokenBackendError` if the token is malformed, if its
        signature check fails, or if its 'exp' claim indicates it has expired.
        """
        try:
            return jwt.decode(
                token,
                self.get_verifying_key(token),
                algorithms=[self.algorithm],
                audience=self.audience,
                issuer=self.issuer,
                leeway=self.get_leeway(),
                options={
                    "verify_aud": self.audience is not None,
                    "verify_signature": verify,
                },
            )
        except InvalidAlgorithmError as e:
            raise TokenBackendError(_("Invalid algorithm specified")) from e
        except ExpiredSignatureError as e:
            raise TokenBackendExpiredToken(_("Token is expired")) from e
        except InvalidTokenError as e:
            raise TokenBackendError(_("Token is invalid")) from e

        Performs a validation of the given token and returns its payload
        dictionary.

        Raises a `TokenBackendError` if the token is malformed, if its
        signature check fails, or if its 'exp' claim indicates it has expired.
        
rest_framework_simplejwt/backends.py