def _update_session_token_cb(self, creds, provider='aws', callback=None, error=None, attempts=0):
    def raise_error():
      # get out of locked state
      self.provider.security_token = None
      if callable(callback):
        return callback(error=error)
      else:
        logging.error(error)
        raise error
    if error:
      if isinstance(error, InvalidClientTokenIdError):
        # no need to retry if error is due to bad tokens
        raise_error()
      else:
        if attempts > self.max_sts_attempts:
          raise_error()
        else:
          seconds_to_wait = (0.1 * (2 ** attempts))
          logging.warning("Got error[ %s ] getting session token, retrying in %.02f seconds" % (error, seconds_to_wait))
          ioloop.IOLoop.current().add_timeout(time.time() + seconds_to_wait,
            functools.partial(self._update_session_token, attempts=attempts + 1, callback=callback, bypass_lock=True))
          return
    else:
      self.provider = Provider(provider,
                               creds.access_key,
                               creds.secret_key,
                               creds.session_token)
      # force the correct auth, with the new provider
      self._auth_handler = HmacAuthV3HTTPHandler(self.host, None, self.provider)
      while self.pending_requests:
        request = self.pending_requests.pop()
        request()
      if callable(callback):
        return callback()
Equivalent to the main program for the application.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/asyncdynamo.py/AsyncDynamoDB._update_session_token_cb--crossover with--dataset/ETHPy150Open openstack/python-neutronclient/neutronclient/shell.py/NeutronShell.run