code: def _path_mask(cost_matrix, path, ax, theme=None):
      _check_soft_dependencies("matplotlib")
  
      import matplotlib.colors as colorplt
  
      if theme is None:
          theme = colorplt.LinearSegmentedColormap.from_list(
              "", ["#c9cacb", "white"]
          )
  
      plot_matrix = np.zeros_like(cost_matrix)
      max_size = max(cost_matrix.shape)
      for i in range(max_size):
          for j in range(max_size):
              if (i, j) in path:
                  plot_matrix[i, j] = 1.0
              elif cost_matrix[i, j] == np.inf:
                  plot_matrix[i, j] = 0.0
              else:
                  plot_matrix[i, j] = 0.25
  
      for i in range(max_size):
          for j in range(max_size):
              c = cost_matrix[j, i]
              ax.text(
                  i,
                  j,
                  str(round(c, 2)),
                  va="center",
                  ha="center",
                  size=10,
              )
              ax.text(
                  i,
                  j,
                  str(round(c, 2)),
                  va="center",
                  ha="center",
                  size=10,
              )
  
      ax.matshow(plot_matrix, cmap=theme)
  
imports: import numpy
  from sktime.distances._distance import distance_alignment_path, pairwise_distance
  from sktime.utils.validation._dependencies import _check_soft_dependencies
label_desc: Use image node_id 1 for calling a global function with example usage: _path_mask(cost_matrix, path, ax, theme) without return types