code: def logprob_ifelse(op, values, if_var, *base_rvs, **kwargs):
      """Compute the log-likelihood graph for an `IfElse`."""
  
      assert len(values) * 2 == len(base_rvs)
  
      rvs_to_values_then = {
          then_rv: value
          for then_rv, value in zip(base_rvs[: len(values)], values)
      }
      rvs_to_values_else = {
          else_rv: value
          for else_rv, value in zip(base_rvs[len(values) :], values)
      }
  
      logps_then = [
          _logprob_helper(rv_then, value, **kwargs)
          for rv_then, value in rvs_to_values_then.items()
      ]
      logps_else = [
          _logprob_helper(rv_else, value, **kwargs)
          for rv_else, value in rvs_to_values_else.items()
      ]
  
      # If the multiple variables depend on each other, we have to replace them
      # by the respective values
      logps_then = replace_rvs_by_values(
          logps_then, rvs_to_values=rvs_to_values_then
      )
      logps_else = replace_rvs_by_values(
          logps_else, rvs_to_values=rvs_to_values_else
      )
  
      logps = ifelse(if_var, logps_then, logps_else)
      if len(logps) == 1:
          return logps[0]
      return logps
  
imports: from typing import List, Optional, Tuple, Union, cast
  import pytensor
  import pytensor.tensor
  from pytensor.graph.basic import Apply, Constant, Variable
  from pytensor.graph.fg import FunctionGraph
  from pytensor.graph.op import Op, compute_test_value
  from pytensor.graph.rewriting.basic import EquilibriumGraphRewriter, node_rewriter
  from pytensor.ifelse import IfElse, ifelse
  from pytensor.scalar import Switch
  from pytensor.scalar import switch
  from pytensor.tensor.basic import Join, MakeVector, switch
  from pytensor.tensor.random.rewriting import local_dimshuffle_rv_lift, local_rv_size_lift, local_subtensor_rv_lift
  from pytensor.tensor.rewriting.shape import ShapeFeature
  from pytensor.tensor.shape import shape_tuple
  from pytensor.tensor.subtensor import AdvancedSubtensor, AdvancedSubtensor1, as_index_literal, get_canonical_form_slice, is_basic_idx
  from pytensor.tensor.type import TensorType
  from pytensor.tensor.type_other import NoneConst, NoneTypeT, SliceConstant, SliceType
  from pytensor.tensor.variable import TensorVariable
  from pymc.logprob.abstract import MeasurableElemwise, MeasurableVariable, _logprob, _logprob_helper
  from pymc.logprob.rewriting import PreserveRVMappings, assume_measured_ir_outputs, local_lift_DiracDelta, measurable_ir_rewrites_db, subtensor_ops
  from pymc.logprob.utils import check_potential_measurability, replace_rvs_by_values
  from pymc.pytensorf import constant_fold
label_desc: Use image node_id 11 for calling a global function with example usage: logprob_ifelse(op, values, if_var) and returns: logps, logps