code: def _njit_subsequence_path(acc_cost_mat, idx_path_end):
      r"""Compute the optimal path through an accumulated cost matrix given the
      endpoint of the sequence.
  
      Parameters
      ----------
      acc_cost_mat: array-like, shape=(sz1, sz2)
          Accumulated cost matrix comparing subsequence from a longer sequence.
      idx_path_end: int
          The end position of the matched subsequence in the longer sequence.
  
      Returns
      -------
      path: list of tuples of integer pairs
          Matching path represented as a list of index pairs. In each pair, the
          first index corresponds to `subseq` and the second one corresponds to
          `longseq`. The startpoint of the Path is :math:`P_0 = (0, ?)` and it
          ends at :math:`P_L = (len(subseq)-1, idx\_path\_end)`
      """
      sz1, sz2 = acc_cost_mat.shape
      path = [(sz1 - 1, idx_path_end)]
      while path[-1][0] != 0:
          i, j = path[-1]
          if i == 0:
              path.append((0, j - 1))
          elif j == 0:
              path.append((i - 1, 0))
          else:
              arr = numpy.array(
                  [
                      acc_cost_mat[i - 1][j - 1],
                      acc_cost_mat[i - 1][j],
                      acc_cost_mat[i][j - 1],
                  ]
              )
              argmin = numpy.argmin(arr)
              if argmin == 0:
                  path.append((i - 1, j - 1))
              elif argmin == 1:
                  path.append((i - 1, j))
              else:
                  path.append((i, j - 1))
      return path[::-1]
  
imports: import warnings
  import numpy
  from numba import njit, prange
  from tslearn.backend import instantiate_backend
  from tslearn.utils import to_time_series
  from .utils import _cdist_generic
label_desc: Use image node_id 22 for calling a global function with example usage: _njit_subsequence_path(acc_cost_mat, idx_path_end) and returns: path