code: def ifelse_lift_single_if_through_acceptable_ops(main_node):
      """This optimization lifts up certain ifelse instances.
  
          op(ifelse(c, x, y)) -> ifelse(c, op(x), op(y))
  
      if `op` is in the `acceptable_ops` list, and there is no other if as
      input to that specific `op`, and the if has no other clients !?
      """
      if not (isinstance(main_node.op, acceptable_ops)):
          return False
      all_inp_nodes = set()
      for inp in main_node.inputs:
          all_inp_nodes.add(inp.owner)
      ifnodes = [
          x
          for x in list(all_inp_nodes)
          if x and isinstance(x.op, IfElse)
      ]
      # if we have multiple ifs as inputs .. it all becomes quite complicated
      # :)
      if len(ifnodes) != 1:
          return False
      node = ifnodes[0]
      op = node.op
  
      ts = node.inputs[1:][: op.n_outs]
      fs = node.inputs[1:][op.n_outs :]
  
      # outs = main_node.outputs
      mop = main_node.op
      true_ins = []
      false_ins = []
  
      for x in main_node.inputs:
          if x in node.outputs:
              idx = node.outputs.index(x)
              true_ins.append(ts[idx])
              false_ins.append(fs[idx])
          else:
              true_ins.append(x)
              false_ins.append(x)
      true_eval = mop(*true_ins, **dict(return_list=True))
      false_eval = mop(*false_ins, **dict(return_list=True))
      # true_eval  = clone(outs, replace = dict(zip(node.outputs, ts)))
      # false_eval = clone(outs, replace = dict(zip(node.outputs, fs)))
  
      nw_outs = ifelse(
          node.inputs[0], true_eval, false_eval, return_list=True
      )
      return nw_outs
  
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 3 for calling a global function with example usage: ifelse_lift_single_if_through_acceptable_ops(main_node) and returns: nw_outs, False, False