code: def cond_remove_identical(fgraph, node):
      op = node.op
  
      if not isinstance(op, IfElse):
          return False
      aes = node.inputs[1:][: op.n_outs]
      fs = node.inputs[1:][op.n_outs :]
  
      # sync outs
      out_map = {}
      for idx in range(len(node.outputs)):
          if idx not in out_map:
              for jdx in range(idx + 1, len(node.outputs)):
                  if (
                      aes[idx] == aes[jdx]
                      and fs[idx] == fs[jdx]
                      and jdx not in out_map
                  ):
                      out_map[jdx] = idx
  
      if len(out_map) == 0:
          return False
  
      nw_ts = []
      nw_fs = []
      inv_map = {}
      pos = 0
      for idx in range(len(node.outputs)):
          if idx not in out_map:
              inv_map[idx] = pos
              pos = pos + 1
              nw_ts.append(aes[idx])
              nw_fs.append(fs[idx])
  
      new_ifelse = IfElse(
          n_outs=len(nw_ts), as_view=op.as_view, name=op.name
      )
  
      new_ins = [node.inputs[0]] + nw_ts + nw_fs
      new_outs = new_ifelse(*new_ins, return_list=True)
  
      rval = []
      for idx in range(len(node.outputs)):
          if idx in out_map:
              rval += [new_outs[inv_map[out_map[idx]]]]
          else:
              rval += [new_outs[inv_map[idx]]]
  
      return rval
  
imports: from collections.abc import Sequence
  from copy import deepcopy
  from typing import TYPE_CHECKING, Any, Optional, Union
  import numpy
  import pytensor.tensor
  from pytensor import as_symbolic
  from pytensor.compile import optdb
  from pytensor.configdefaults import config
  from pytensor.graph.basic import Apply, Variable, apply_depends_on
  from pytensor.graph.op import _NoPythonOp
  from pytensor.graph.replace import clone_replace
  from pytensor.graph.rewriting.basic import GraphRewriter, in2out, node_rewriter
  from pytensor.graph.type import HasDataType, HasShape
  from pytensor.tensor.shape import Reshape, Shape, SpecifyShape, Unbroadcast
label_desc: Use image node_id 6 for calling a global function with example usage: cond_remove_identical(fgraph, node) and returns: rval, False, False