code: def ensure_permission_set_tree_cached(user):
      
      if hasattr(user, CACHED_PSET_PROPERTY_KEY):
          return
      try:
          setattr(
              user, CACHED_PSET_PROPERTY_KEY, _get_permission_set_tree(user))
      except ObjectDoesNotExist:  # No permission set
          pass
docs: Helper to cache permission set tree on user instance