code: def cls_fit_dki(
      design_matrix,
      data,
      inverse_design_matrix,
      sdp,
      weights=True,
      min_diffusivity=0,
      cvxpy_solver=None,
  ):
      r"""Compute the diffusion and kurtosis tensors using a constrained
      ordinary or weighted linear least squares approach [1]_
  
      Parameters
      ----------
      design_matrix : array (g, 22)
          Design matrix holding the covariants used to solve for the regression
          coefficients.
      data : array (g)
          Data or response variables holding the data.
      inverse_design_matrix : array (22, g)
          Inverse of the design matrix.
      sdp : PositiveDefiniteLeastSquares instance
          A CVXPY representation of a regularized least squares optimization
          problem.
      weights : bool, optional
          Parameter indicating whether weights are used. Default: True.
      min_diffusivity : float, optional
          Because negative eigenvalues are not physical and small eigenvalues,
          much smaller than the diffusion weighting, cause quite a lot of noise
          in metrics such as fa, diffusivity values smaller than `min_diffusivity`
          are replaced with `min_diffusivity`.
      cvxpy_solver : str, optional
          cvxpy solver name. Optionally optimize the positivity constraint with a
          particular cvxpy solver. See https://www.cvxpy.org/ for details.
          Default: None (cvxpy chooses its own solver).
  
      Returns
      -------
      dki_params : array (27)
      All parameters estimated from the diffusion kurtosis model for all N
      voxels. Parameters are ordered as follows:
          1) Three diffusion tensor eigenvalues.
          2) Three blocks of three elements, containing the first second and
              third coordinates of the diffusion tensor eigenvectors.
          3) Fifteen elements of the kurtosis tensor.
  
      References
      ----------
      .. [1] Dela Haije et al. "Enforcing necessary non-negativity constraints for
             common diffusion MRI models using sum of squares programming".
             NeuroImage 209, 2020, 116405.
      """
      # Set up least squares problem
      A = design_matrix
      y = np.log(data)
  
      # Define sqrt weights as diag(yn)
      if weights:
          result = np.dot(inverse_design_matrix, y)
          W = np.diag(np.exp(np.dot(A, result)))
          A = np.dot(W, A)
          y = np.dot(W, y)
  
      # Solve sdp
      result = sdp.solve(A, y, check=True, solver=cvxpy_solver)
  
      # Write output
      dki_params = params_to_dki_params(
          result, min_diffusivity=min_diffusivity
      )
  
      return dki_params, None
  
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 23 for calling a global function with example usage: cls_fit_dki(design_matrix, data, inverse_design_matrix, sdp, weights, min_diffusivity, cvxpy_solver) and returns: dki_params,  None