code: def access_token_valid(self, token, log_msg):
          
          if (token in self.access_tokens):
              (cookie, issue_time) = self.access_tokens[token]
              age = int(time.time()) - issue_time
              if (age <= (self.access_token_lifetime + 1)):
                  self.logger.info(log_msg + " " + token +
                                   " ACCEPTED TOKEN (%ds old)" % age)
                  return True
              # Expired...
              self.logger.info(log_msg + " " + token +
                               " EXPIRED TOKEN (%ds old > %ds)" %
                               (age, self.access_token_lifetime))
              # Keep token for 2x lifetim in order to generate
              # helpful expired message
              if (age > (self.access_token_lifetime * 2)):
                  del self.access_tokens[token]
              return False
          else:
              self.logger.info(log_msg + " " + token + " REJECTED TOKEN")
              return False
docs: Check token validity.
  
          Returns true if the token is valid. The set of allowed access tokens
          is stored in self.access_tokens.
  
          Uses log_msg as prefix to info level log message of acceptance or
          rejection.