code: def is_rv_used_in_graph(base_rv, node, fgraph):
      """Determine whether or not `base_rv` is used by a node other than `node` in `fgraph`.
  
      If a node uses `Shape` or `Shape_i` on the `base_rv`, we ignore it, because
      those `Op`s don't rely on the actual sample values of `base_rv`.
  
      TODO: We should apply all the shape rewrites before these rewrites, since
      that would properly remove the unnecessary dependencies on `base_rv` (when
      possible).
  
      """
  
      def _node_check(n, i):
          if n == "output":
              n = fgraph.outputs[i].owner
          return n == node or isinstance(n.op, (Shape, Shape_i))
  
      return not all(
          _node_check(n, i) for n, i in fgraph.clients.get(base_rv, ())
      )
  
imports: from itertools import chain
  from pytensor.compile import optdb
  from pytensor.configdefaults import config
  from pytensor.graph import ancestors
  from pytensor.graph.op import compute_test_value
  from pytensor.graph.rewriting.basic import copy_stack_trace, in2out, node_rewriter
  from pytensor.scalar import integer_types
  from pytensor.tensor import NoneConst
  from pytensor.tensor.basic import constant, get_vector_length
  from pytensor.tensor.elemwise import DimShuffle
  from pytensor.tensor.extra_ops import broadcast_to
  from pytensor.tensor.random.op import RandomVariable
  from pytensor.tensor.random.utils import broadcast_params
  from pytensor.tensor.shape import Shape, Shape_i, shape_padleft
  from pytensor.tensor.subtensor import AdvancedSubtensor, AdvancedSubtensor1, Subtensor, as_index_variable, get_idx_list
  from pytensor.tensor.type_other import SliceType
label_desc: Use image node_id 1 for calling a global function with example usage: is_rv_used_in_graph(base_rv, node, fgraph) and returns: unknown, unknown