code: def test_precomputed_cost(method, n_timestamps_1, n_timestamps_2):
      rng = np.random.RandomState(42)
      x = rng.randn(n_timestamps_1)
      y = rng.randn(n_timestamps_2)
      squared_cost = (x[:, None] - y[None, :]) ** 2
      dtw_desired = dtw(x, y, method=method, dist="square")
      dtw_desired **= 2
      dtw_precomputed = dtw(
          method=method,
          dist="precomputed",
          precomputed_cost=squared_cost,
      )
      np.testing.assert_allclose(dtw_desired, dtw_precomputed)
  
imports: import numpy
  import pytest
  import re
  from math import sqrt
  from numba import njit
  from pyts.metrics.dtw import _square, _absolute, _check_input_dtw, _blurred_path_region, _return_path, _return_results, cost_matrix, accumulated_cost_matrix, _check_region, _dtw_classic, _dtw_region, _dtw_sakoechiba, _dtw_itakura, _dtw_multiscale, _dtw_fast
  from pyts.metrics import dtw, itakura_parallelogram, sakoe_chiba_band, show_options
label_desc: Use image node_id 29 for calling a global function with example usage: test_precomputed_cost(method, n_timestamps_1, n_timestamps_2) without return types