code: def exhaust(brule):
      """Apply a branching rule repeatedly until it has no effect"""
  
      def exhaust_brl(expr):
          seen = {expr}
          for nexpr in brule(expr):
              if nexpr not in seen:
                  seen.add(nexpr)
                  yield from exhaust_brl(nexpr)
          if seen == {expr}:
              yield expr
  
      return exhaust_brl
  
file_path: sympy/sympy/strategies/branch/core.py
label_desc: Use image node_id 2 for calling a global function with example usage: exhaust(brule) and returns: exhaust_brl