code: def get_token_status(token, serializer, max_age=None, return_data=False):
      
      serializer = getattr(_security, serializer + '_serializer')
      max_age = get_max_age(max_age)
      user, data = None, None
      expired, invalid = False, False
  
      try:
          data = serializer.loads(token, max_age=max_age)
      except SignatureExpired:
          d, data = serializer.loads_unsafe(token)
          expired = True
      except (BadSignature, TypeError, ValueError):
          invalid = True
  
      if data:
          user = _datastore.find_user(id=data[0])
  
      expired = expired and (user is not None)
  
      if return_data:
          return expired, invalid, user, data
      else:
          return expired, invalid, user
docs: Get the status of a token.
  
      :param token: The token to check
      :param serializer: The name of the seriailzer. Can be one of the
                         following: ``confirm``, ``login``, ``reset``
      :param max_age: The name of the max age config option. Can be on of
                      the following: ``CONFIRM_EMAIL``, ``LOGIN``,
                      ``RESET_PASSWORD``