code: def _calc_token_valid_period_sec(
      self, token, exp=None, at_least_sec=None
  ):
      if token:
          try:
              exp = exp or self._get_token_exp(token)
              if at_least_sec:
                  at_least_sec = max(
                      at_least_sec, self.token_expiration_threshold_sec
                  )
              else:
                  at_least_sec = self.token_expiration_threshold_sec
              return max(0, (exp - time() - at_least_sec))
          except Exception:
              pass
      return 0
  
imports: import sys
  from abc import ABCMeta, abstractmethod
  from time import time
  import jwt
  from jwt.algorithms import get_default_algorithms
  import six
label_desc: Use image node_id 9 for calling the TokenManager obj's underlying member method code with example usage: obj._calc_token_valid_period_sec(token, exp, at_least_sec) and returns: int, max