code: def compute_min_return_path(
      cost_matrix: np.ndarray, bounding_matrix: np.ndarray
  ) -> List[Tuple]:
      """Compute the minimum cost path through the cost matrix.
  
      The return path is computed by finding a path through the cost matrix by taking
      the min(cost_matrix[i - 1][j - 1], cost_matrix[i - 1][j], cost_matrix[i][j - 1]).
      This is ideal for dtw based distances or others where the objective is to minimise
      the cost.
  
      Parameters
      ----------
      cost_matrix: np.ndarray (of size (n, m) where n is the length of the first time
                      series and m is the length of the second time series)
          Cost matrix used to compute the distance.
      bounding_matrix: np.ndarray (of size (n, m) where n is the length of the first
                      time series and m is the length of the second time series)
          The bounding matrix that restricts the warping path.
  
      Returns
      -------
      list[tuple]
          List containing tuples that is the path through the cost matrix.
      """
      x_size, y_size = cost_matrix.shape
  
      for i in range(x_size):
          for j in range(y_size):
              if not np.isfinite(bounding_matrix[i, j]):
                  cost_matrix[i, j] = np.inf
  
      i = x_size - 1
      j = y_size - 1
      alignment = []
      while True:
          alignment.append((i, j))
  
          if alignment[-1] == (0, 0):
              break
  
          arr = np.array(
              [
                  cost_matrix[i - 1, j - 1],
                  cost_matrix[i - 1, j],
                  cost_matrix[i, j - 1],
              ]
          )
          min_index = np.argmin(arr)
  
          if min_index == 0:
              i = i - 1
              j = j - 1
          elif min_index == 1:
              i = i - 1
          else:
              j = j - 1
  
      return alignment[::-1]
  
imports: from typing import List, Tuple
  import numpy
  from sktime.utils.numba.njit import njit
label_desc: Use image node_id 1 for calling a global function with example usage: compute_min_return_path(cost_matrix, bounding_matrix) and returns: alignment