code: def _approx_fprime(xk, f, epsilon, args=()):
      f0 = f(*((xk,) + args))
      grad = np.zeros((f0.shape[0], f0.shape[1], len(xk)), float)
      ei = np.zeros((len(xk),), float)
      for k in range(len(xk)):
          ei[k] = 1.0
          d = epsilon * ei
          grad[:, :, k] = (f(*((xk + d,) + args)) - f0) / d[k]
          ei[k] = 0.0
      return grad
  
imports: import numpy
  from scipy import optimize
  from scipy.spatial.distance import pdist, squareform
  from numpy.testing import assert_array_almost_equal
  from numpy.testing import assert_array_equal
  import pytest
  from skopt.learning.gaussian_process import GaussianProcessRegressor
  from skopt.learning.gaussian_process.kernels import ConstantKernel
  from skopt.learning.gaussian_process.kernels import DotProduct
  from skopt.learning.gaussian_process.kernels import ExpSineSquared
  from skopt.learning.gaussian_process.kernels import HammingKernel
  from skopt.learning.gaussian_process.kernels import Matern
  from skopt.learning.gaussian_process.kernels import RationalQuadratic
  from skopt.learning.gaussian_process.kernels import RBF
  from skopt.learning.gaussian_process.kernels import WhiteKernel
label_desc: Use image node_id 1 for calling a global function with example usage: _approx_fprime(xk, f, epsilon, args) and returns: grad