code: def cond_remove_identical(node):
      op = node.op
  
      if not isinstance(op, IfElse):
          return False
      ts = node.inputs[1:][: op.n_outs]
      fs = node.inputs[1:][op.n_outs :]
  
      # sync outs
      out_map = {}
      for idx in xrange(len(node.outputs)):
          if idx not in out_map:
              for jdx in xrange(idx + 1, len(node.outputs)):
                  if (
                      ts[idx] == ts[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 xrange(len(node.outputs)):
          if idx not in out_map:
              inv_map[idx] = pos
              pos = pos + 1
              nw_ts.append(ts[idx])
              nw_fs.append(fs[idx])
  
      new_ifelse = IfElse(
          n_outs=len(nw_ts),
          as_view=op.as_view,
          gpu=op.gpu,
          name=op.name,
      )
  
      new_ins = [node.inputs[0]] + nw_ts + nw_fs
      new_outs = new_ifelse(*new_ins, **dict(return_list=True))
  
      rval = []
      for idx in xrange(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 __future__ import absolute_import, print_function, division
  from copy import deepcopy
  from theano.compat import izip
  import logging
  import numpy
  import theano.tensor
  from theano.tensor import TensorType
  from theano import gof
  from theano.gof import Op, Apply
  from six import iteritems
  from six.moves import xrange
  from theano.compile import optdb
  from theano.tensor import opt
  from theano.scan_module.scan_utils import clone
label_desc: Use image node_id 6 for calling a global function with example usage: cond_remove_identical(node) and returns: rval, False, False