code: def approx_hessian_diag(f, x, epsilon):
      """
      Approximate the Hessian diagonal of a function using central
      finite differences
  
      Parameters
      ----------
      f: callable
        The function to differentiate
      x: ndarray
        Point where the Hessian is to be evaluated
      epsilon: float
        Stepsize for finite differences
  
      Returns
      -------
      h: ndarray
        Diagonal of the Hessian at `x`
      """
      n = len(x)
      h = np.zeros(n)
      ei = np.zeros(n)
      fx = f(x)
      for i in range(n):
          ei[i] = epsilon
          h[i] = (f(x + ei) + f(x - ei) - 2 * fx) / (epsilon**2)
          ei[i] = 0
      return h
  
imports: import numpy
  import scipy.ndimage
  from ...core.image.image_spaces import as_xyz_image, make_xyz_image, xyz_affine
  from ._registration import _joint_histogram
  from .affine import affine_transforms, inverse_affine, subgrid_affine
  from .chain_transform import ChainTransform
  from .optimizer import configure_optimizer
  from .similarity_measures import similarity_measures
label_desc: Use image node_id 6 for calling a global function with example usage: approx_hessian_diag(f, x, epsilon) and returns: h