code: def apply(self, graph):
      # Copy the graph. Don't change the original.
      graph = copy.deepcopy(graph)
  
      while True:
          matches, _ = graph.search(self.pattern)
          if not matches:
              break
          # Tag found nodes and their incoming branches
          for n in matches:
              self.tag(n, "delete", graph)
          # Find all tagged nodes and delete them
          tagged = [
              n
              for n in graph.nodes.values()
              if hasattr(n, "__tag__") and n.__tag__ == "delete"
          ]
          graph.remove(tagged)
      return graph
  
imports: import re
  import copy
  from .graph import Node
  from .None import ge
label_desc: Use image node_id 3 for calling the PruneBranch obj's underlying member method code with example usage: obj.apply(graph) and returns: graph