code: def get_random_outer_outputs(
      scan_args: ScanArgs,
  ) -> List[Tuple[int, TensorVariable, TensorVariable]]:
      """Get the `MeasurableVariable` outputs of a `Scan` (well, its `ScanArgs`).
  
      Returns
      -------
      A tuple of tuples containing the index of each outer-output variable, the
      outer-output variable itself, and the inner-output variable that
      is an instance of `MeasurableVariable`.
      """
      rv_vars = []
      for n, oo_var in enumerate(
          [
              o
              for o in scan_args.outer_outputs
              if not isinstance(o.type, RandomType)
          ]
      ):
          oo_info = scan_args.find_among_fields(oo_var)
          io_type = oo_info.name[(oo_info.name.index("_", 6) + 1) :]
          inner_out_type = f"inner_out_{io_type}"
          io_var = getattr(scan_args, inner_out_type)[oo_info.index]
          if io_var.owner and isinstance(
              io_var.owner.op, MeasurableVariable
          ):
              rv_vars.append((n, oo_var, io_var))
      return rv_vars
  
imports: from copy import copy
  from typing import Callable, Dict, Iterable, List, Optional, Tuple, cast
  import numpy
  import pytensor
  import pytensor.tensor
  from pytensor.graph.basic import Variable
  from pytensor.graph.op import compute_test_value
  from pytensor.graph.rewriting.basic import node_rewriter
  from pytensor.graph.rewriting.db import RewriteDatabaseQuery
  from pytensor.scan.op import Scan
  from pytensor.scan.rewriting import scan_eqopt1, scan_eqopt2
  from pytensor.scan.utils import ScanArgs
  from pytensor.tensor.random.type import RandomType
  from pytensor.tensor.subtensor import Subtensor, indices_from_subtensor
  from pytensor.tensor.variable import TensorVariable
  from pytensor.updates import OrderedUpdates
  from pymc.logprob.abstract import MeasurableVariable, _logprob
  from pymc.logprob.basic import conditional_logp
  from pymc.logprob.rewriting import PreserveRVMappings, construct_ir_fgraph, inc_subtensor_ops, logprob_rewrites_db, measurable_ir_rewrites_db
  from pymc.logprob.utils import replace_rvs_by_values
label_desc: Use image node_id 2 for calling a global function with example usage: get_random_outer_outputs(scan_args) and returns: rv_vars