def will_expire_soon(self, stale_duration=STALE_TOKEN_DURATION): """Determine if expiration is about to occur. :returns: true if expiration is within the given duration :rtype: boolean """ norm_expires = utils.normalize_time(self.expires) # (gyee) should we move auth_token.will_expire_soon() to timeutils # instead of duplicating code here? soon = utils.from_utcnow(seconds=stale_duration) return norm_expires < soon