code: def prune_index(inner_tree, decisions, index=0):
      # Start pruning from the bottom - if we start from the top, we might miss
      # nodes that become leaves during pruning.
      # Do not use this directly - use prune_duplicate_leaves instead.
      if not is_leaf(inner_tree, inner_tree.children_left[index]):
          prune_index(
              inner_tree, decisions, inner_tree.children_left[index]
          )
      if not is_leaf(inner_tree, inner_tree.children_right[index]):
          prune_index(
              inner_tree, decisions, inner_tree.children_right[index]
          )
  
      # Prune children if both children are leaves now and make the same decision:
      if (
          is_leaf(inner_tree, inner_tree.children_left[index])
          and is_leaf(inner_tree, inner_tree.children_right[index])
          and (
              decisions[index]
              == decisions[inner_tree.children_left[index]]
          )
          and (
              decisions[index]
              == decisions[inner_tree.children_right[index]]
          )
      ):
          # turn node into a leaf by "unlinking" its children
          inner_tree.children_left[index] = TREE_LEAF
          inner_tree.children_right[index] = TREE_LEAF
  
imports: import os
  from copy import deepcopy
  from inspect import signature
  from typing import Optional
  from matplotlib import pyplot
  from sklearn import tree
  from sklearn.tree._tree import TREE_LEAF
  from fedot.core.composer.metrics import Metric
  from fedot.core.composer.metrics import R2, F1
  from fedot.core.data.data import InputData
  from fedot.core.pipelines.node import PipelineNode
  from fedot.core.pipelines.pipeline import Pipeline
  from fedot.core.repository.tasks import TaskTypesEnum
  from fedot.explainability.explainer_template import Explainer
label_desc: Use image node_id 4 for calling a global function with example usage: prune_index(inner_tree, decisions, index) without return types