code: def numba_funcify_UnravelIndex(op, node, **kwargs):
      order = op.order
  
      if order != "C":
          raise NotImplementedError(
              "Numba does not support the `order` argument in `numpy.unravel_index`"
          )
  
      if len(node.outputs) == 1:
  
          @numba_basic.numba_njit(inline="always")
          def maybe_expand_dim(arr):
              return arr
  
      else:
  
          @numba_basic.numba_njit(inline="always")
          def maybe_expand_dim(arr):
              return np.expand_dims(arr, 1)
  
      @numba_basic.numba_njit
      def unravelindex(arr, shape):
          a = np.ones(len(shape), dtype=np.int64)
          a[1:] = shape[:0:-1]
          a = np.cumprod(a)[::-1]
  
          # PyTensor actually returns a `tuple` of these values, instead of an
          # `ndarray`; however, this `ndarray` result should be able to be
          # unpacked into a `tuple`, so this discrepancy shouldn't really matter
          return ((maybe_expand_dim(arr) // a) % shape).T
  
      return unravelindex
  
imports: import warnings
  from typing import cast
  import numba
  import numpy
  from pytensor import config
  from pytensor.graph import Apply
  from pytensor.link.numba.dispatch import basic
  from pytensor.link.numba.dispatch.basic import get_numba_type, numba_funcify
  from pytensor.raise_op import CheckAndRaise
  from pytensor.tensor import TensorVariable
  from pytensor.tensor.extra_ops import Bartlett, CumOp, FillDiagonal, FillDiagonalOffset, RavelMultiIndex, Repeat, SearchsortedOp, Unique, UnravelIndex
label_desc: Use image node_id 8 for calling a global function with example usage: numba_funcify_UnravelIndex(op, node) and returns: unravelindex, unknown, arr, np