code: def accumulated_cost_matrix(cost_mat, region=None):
      """Compute the accumulated cost matrix.
  
      Parameters
      ----------
      cost_mat : array-like, shape = (n_timestamps_1, n_timestamps_2)
          Cost matrix.
  
      region : None or tuple, shape = (2, n_timestamps_1) (default = None)
          Constraint region. If None, there is no contraint region.
          If array-like, the first row indicates the starting indices (included)
          and the second row the ending indices (excluded) of the valid rows
          for each column.
  
      Returns
      -------
      acc_cost_mat : array, shape = (n_timestamps_1, n_timestamps_2)
          Accumulated cost matrix.
  
      """
      cost_mat = check_array(
          cost_mat,
          ensure_min_samples=2,
          ensure_min_features=2,
          ensure_2d=True,
          force_all_finite=False,
          dtype="float64",
      )
      cost_mat_shape = cost_mat.shape
  
      if region is None:
          acc_cost_mat = _accumulated_cost_matrix_no_region(cost_mat)
      else:
          region = check_array(region, dtype="int64")
          region_shape = region.shape
          if region_shape != (2, cost_mat_shape[0]):
              raise ValueError(
                  "The shape of 'region' must be equal to "
                  "(2, n_timestamps_1) "
                  "(got {0})".format(region_shape)
              )
          acc_cost_mat = _accumulated_cost_matrix_region(
              cost_mat, region
          )
      return acc_cost_mat
  
imports: import numpy
  from math import ceil, log2, sqrt
  from numba import njit, prange
  from sklearn.utils import check_array
label_desc: Use image node_id 12 for calling a global function with example usage: accumulated_cost_matrix(cost_mat, region) and returns: acc_cost_mat