code: def invalidate_cache_after_error(f):
      
      @wraps(f)
      def wrapper(self, *args, **kwds):
          try:
              return f(self, *args, **kwds)
          except Exception:
              self.clear_cluster_nodes_cache()
              raise
      return wrapper
docs: catch any exception and invalidate internal cache with list of nodes