async def METHOD_NAME(self):
    should_this_thread_refresh = False
    async with self._lock:
        while self._is_token_expiring_soon(self._token):
            if self._some_thread_refreshing:
                if self._is_token_valid(self._token):
                    return self._token
                await self._wait_till_lock_owner_finishes_refreshing()
            else:
                should_this_thread_refresh = True
                self._some_thread_refreshing = True
                break
    if should_this_thread_refresh:
        try:
            new_token = await self._token_refresher()
            if not self._is_token_valid(new_token):
                raise ValueError(
                    "The token returned from the token_refresher is expired."
                )
            async with self._lock:
                self._token = new_token
                self._some_thread_refreshing = False
                self._lock.notify_all()
        except:
            async with self._lock:
                self._some_thread_refreshing = False
                self._lock.notify_all()
            raise
    if self._proactive_refresh:
        self._schedule_refresh()
    return self._token