code: def ifelse_lift_single_if_through_acceptable_ops(fgraph, 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
  
      aes = 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(aes[idx])
              false_ins.append(fs[idx])
          else:
              true_ins.append(x)
              false_ins.append(x)
      true_eval = mop(*true_ins, return_list=True)
      false_eval = mop(*false_ins, return_list=True)
      # true_eval  = clone_replace(outs, replace = dict(zip(node.outputs, aes)))
      # false_eval = clone_replace(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 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 3 for calling a global function with example usage: ifelse_lift_single_if_through_acceptable_ops(fgraph, main_node) and returns: nw_outs, False, False