code: def test_recurrence_to_lag(n, pad):
      srand()
      data = np.random.randn(17, n)
  
      rec = librosa.segment.recurrence_matrix(data)
  
      lag = librosa.segment.recurrence_to_lag(rec, pad=pad, axis=-1)
      lag2 = librosa.segment.recurrence_to_lag(rec.T, pad=pad, axis=0)
  
      assert np.allclose(lag, lag2.T)
  
      x: Union[ellipsis, slice] = Ellipsis
      if pad:
          x = slice(n)
  
      for i in range(n):
          assert np.allclose(rec[:, i], np.roll(lag[:, i], i)[x])
  
imports: from typing import Union
  import warnings
  import os
  import numpy
  import scipy
  from scipy.spatial.distance import cdist, pdist, squareform
  import pytest
  from test_core import srand
  import librosa
label_desc: Use image node_id 25 for calling a global function with example usage: test_recurrence_to_lag(n, pad) without return types