code: def ref_2d(func, x, **kwargs):
      """Calculate 2-D reference data from a 1d transform"""
      x = np.array(x, copy=True)
      for row in range(x.shape[0]):
          x[row, :] = func(x[row, :], **kwargs)
      for col in range(x.shape[1]):
          x[:, col] = func(x[:, col], **kwargs)
      return x
  
imports: from os.path import join, dirname
  from typing import Callable, Union
  import numpy
  from numpy.testing import assert_array_almost_equal, assert_equal, assert_allclose
  import pytest
  from pytest import raises
  from scipy.fft._pocketfft.realtransforms import dct, idct, dst, idst, dctn, idctn, dstn, idstn
label_desc: Use image node_id 8 for calling a global function with example usage: ref_2d(func, x) and returns: x