code: def _set_token_defaults(token):
      
      def _verify_version(jwt_version):
          supported_version = Version(
              settings.JWT_AUTH.get('JWT_SUPPORTED_VERSION', JwtTokenVersion.default_latest_supported)
          )
          if jwt_version.major > supported_version.major:
              logger.info('Token decode failed due to unsupported JWT version number [%s]', str(jwt_version))
              raise jwt.InvalidTokenError('JWT version number [%s] is unsupported', str(jwt_version))
  
      def _get_and_set_version(token):
          """
          Tokens didn't always contain a version number so we
          default to a nominal starting number.
          """
          if 'version' not in token:
              token['version'] = str(JwtTokenVersion.starting_version)
  
          return Version(token['version'])
  
      def _set_is_restricted(token):
          """
          We can safely default to False since all "restricted" tokens
          created prior to the addition of the `is_restricted` flag were
          always created as expired tokens. Expired tokens would not
          validate and so would not get this far into the decoding process.
          # TODO: ARCH-166
          """
          if 'is_restricted' not in token:
              token['is_restricted'] = False
  
      def _set_filters(token):
          """
          We can safely default to an empty list of filters since
          previously created tokens were either "restricted" (always
          expired) or had full access.
          # TODO: ARCH-166
          """
          if 'filters' not in token:
              token['filters'] = []
  
      token_version = _get_and_set_version(token)
      _verify_version(token_version)
      _set_is_restricted(token)
      _set_filters(token)
      return token
docs: Returns an updated token that includes default values for
      fields that were introduced since the token was created
      by checking its version number.