def _validate_refresh_token(self):
        """Validate a refresh token request."""
        if self.refresh_token is None:
            raise InvalidRequest('No refresh_token')
        try:
            self.access_token = AccessToken.objects.get(
                refresh_token=self.refresh_token)
        except AccessToken.DoesNotExist:
            raise InvalidRequest(
                'No such refresh token: %s' % self.refresh_token)
        self._validate_access_credentials()
        if not self.access_token.refreshable:
            raise InvalidGrant("Access token is not refreshable.")
        if self.scope is not None:
            access_ranges = set([x.key for x in self.access_token.scope.all()])
            new_scope = self.scope - access_ranges
            if len(new_scope) > 0:
                raise InvalidScope("Refresh request requested scopes beyond"
                "initial grant: %s" % new_scope)
dataset/ETHPy150Open hiidef/oauth2app/oauth2app/token.py/TokenGenerator._validate_refresh_token/original