code: def _G2m(a, b, c):
      r"""Helper function that computes function $G_2$ which is required to
      compute the analytical solution of the Radial kurtosis
  
      Parameters
      ----------
      a : ndarray
          Array containing the values of parameter $\lambda_1$ of function $G_2$
      b : ndarray
          Array containing the values of parameter $\lambda_2$ of function $G_2$
      c : ndarray (n,)
          Array containing the values of parameter $\lambda_3$ of function $G_2$
  
      Returns
      -------
      G2 : ndarray
         Value of the function $G_2$ for all elements of the arrays a, b, and c
  
      Notes
      -----
      Function $G_2$ is defined as [1]_:
  
      .. math::
  
          G_2(\lambda_1,\lambda_2,\lambda_3)=
          \frac{(\lambda_1+\lambda_2+\lambda_3)^2}{(\lambda_2-\lambda_3)^2}
          \left ( \frac{\lambda_2+\lambda_3}{\sqrt{\lambda_2\lambda_3}}-2\right )
  
      References
      ----------
      .. [1] Tabesh, A., Jensen, J.H., Ardekani, B.A., Helpern, J.A., 2011.
             Estimation of tensors and tensor-derived measures in diffusional
             kurtosis imaging. Magn Reson Med. 65(3), 823-836
  
      """
      # Float error used to compare two floats, abs(l1 - l2) < er for l1 = l2
      # Error is defined as five order of magnitude larger than system's epsilon
      er = np.finfo(a.ravel()[0]).eps * 1e5
  
      # Initialize G2
      G2 = np.zeros(a.shape)
  
      # Only computes G2 in voxels that have all eigenvalues larger than zero
      cond0 = _positive_evals(a, b, c)
  
      # Apply formula for non problematic plausible cases, i.e. b!=c
      cond1 = np.logical_and(cond0, (abs(b - c) > er))
      if np.sum(cond1) != 0:
          L1 = a[cond1]
          L2 = b[cond1]
          L3 = c[cond1]
          G2[cond1] = (
              (L1 + L2 + L3) ** 2
              / (3 * (L2 - L3) ** 2)
              * ((L2 + L3) / np.sqrt(L2 * L3) - 2)
          )
  
      # Resolve possible singularity b==c
      cond2 = np.logical_and(cond0, abs(b - c) < er)
      if np.sum(cond2) != 0:
          L1 = a[cond2]
          L2 = b[cond2]
          G2[cond2] = (L1 + 2.0 * L2) ** 2 / (12.0 * L2**2)
  
      return G2
  
imports: import numpy
  import warnings
  import scipy.optimize
  import dipy.core.sphere
  from dipy.reconst.multi_voxel import multi_voxel_fit
  from dipy.reconst.dti import TensorFit, mean_diffusivity, from_lower_triangular, lower_triangular, decompose_tensor, MIN_POSITIVE_SIGNAL, nlls_fit_tensor, restore_fit_tensor
  from dipy.reconst.utils import dki_design_matrix
  from dipy.reconst.recspeed import local_maxima
  from dipy.reconst.base import ReconstModel
  from dipy.core.ndindex import ndindex
  from dipy.core.geometry import sphere2cart, cart2sphere, perpendicular_directions
  from dipy.core.optimize import PositiveDefiniteLeastSquares
  from dipy.data import get_sphere, get_fnames, load_sdp_constraints
  from dipy.reconst.vec_val_sum import vec_val_vect
  from dipy.core.gradients import check_multi_b
label_desc: Use image node_id 12 for calling a global function with example usage: _G2m(a, b, c) and returns: G2