code: def _ivim_error(params, gtab, signal):
      """Error function to be used in fitting the IVIM model.
  
      Parameters
      ----------
      params : array
          An array of IVIM parameters - [S0, f, D_star, D]
  
      gtab : GradientTable class instance
          Gradient directions and bvalues.
  
      signal : array
          Array containing the actual signal values.
  
      Returns
      -------
      residual : array
          An array containing the difference between actual and estimated signal.
  
      """
      residual = signal - ivim_prediction(params, gtab)
      return residual
  
imports: import warnings
  import numpy
  from scipy.optimize import least_squares, differential_evolution
  from dipy.reconst.base import ReconstModel
  from dipy.reconst.multi_voxel import multi_voxel_fit
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 2 for calling a global function with example usage: _ivim_error(params, gtab, signal) and returns: residual