def METHOD_NAME(self):
    if self._token is None and self.user and self._password:
        self._token = self.__oidc.token(username=self.user, password=self._password)
        self._token['time'] = time.time()
    elif not self._token or not ('expires_in' in self._token and 'time' in self._token):
        # cannot refresh
        return
    elif self._token['expires_in'] < int(time.time()) - self._token['time'] + 10:
        try:
            self._token = self.__oidc.refresh_token(self._token['refresh_token'])
            self._token['time'] = time.time()
        except Exception:
            self._token = self.__oidc.token(username=self.user, password=self._password)
            self._token['time'] = time.time()