code: def _warn_rvs_in_inferred_graph(
      graph: Union[TensorVariable, Sequence[TensorVariable]]
  ):
      """Issue warning if any RVs are found in graph.
  
      RVs are usually an (implicit) conditional input of the derived probability expression,
      and meant to be replaced by respective value variables before evaluation.
      However, when the IR graph is built, any non-input nodes (including RVs) are cloned,
      breaking the link with the original ones.
      This makes it impossible (or difficult) to replace it by the respective values afterward,
      so we instruct users to do it beforehand.
      """
  
      rvs_in_graph = _find_unallowed_rvs_in_graph(graph)
      if rvs_in_graph:
          warnings.warn(
              f"RandomVariables {rvs_in_graph} were found in the derived graph. "
              "These variables are a clone and do not match the original ones on identity.\n"
              "If you are deriving a quantity that depends on model RVs, use `model.replace_rvs_by_values` first. "
              "For example: `logp(model.replace_rvs_by_values([rv])[0], value)`",
              stacklevel=3,
          )
  
imports: import warnings
  from collections import deque
  from typing import Dict, List, Optional, Sequence, Union
  import numpy
  import pytensor.tensor
  from pytensor import config
  from pytensor.graph.basic import Constant, Variable, ancestors, graph_inputs, io_toposort
  from pytensor.graph.op import compute_test_value
  from pytensor.graph.rewriting.basic import GraphRewriter, NodeRewriter
  from pytensor.tensor.variable import TensorVariable
  from typing_extensions import TypeAlias
  from pymc.logprob.abstract import MeasurableVariable, _icdf_helper, _logcdf_helper, _logprob, _logprob_helper
  from pymc.logprob.rewriting import cleanup_ir, construct_ir_fgraph
  from pymc.logprob.transform_value import TransformValuesRewrite
  from pymc.logprob.transforms import Transform
  from pymc.logprob.utils import rvs_in_graph
  from pymc.pytensorf import replace_vars_in_graphs
label_desc: Use image node_id 2 for calling a global function with example usage: _warn_rvs_in_inferred_graph(graph) without return types