code: def ivim_model_selector(gtab, fit_method="trr", **kwargs):
      """
      Selector function to switch between the 2-stage Trust-Region Reflective
      based NLLS fitting method (also containing the linear fit): `trr` and the
      Variable Projections based fitting method: `varpro`.
  
      Parameters
      ----------
      fit_method : string, optional
          The value fit_method can either be 'trr' or 'varpro'.
          default : trr
  
      """
      bounds_warning = (
          "Bounds for this fit have been set from experiments "
      )
      bounds_warning += (
          "and literature survey. To change the bounds, please "
      )
      bounds_warning += "input your bounds in model definition..."
  
      if fit_method.lower() == "trr":
          ivimmodel_trr = IvimModelTRR(gtab, **kwargs)
          if "bounds" not in kwargs:
              warnings.warn(bounds_warning, UserWarning)
          return ivimmodel_trr
  
      elif fit_method.lower() == "varpro":
          ivimmodel_vp = IvimModelVP(gtab, **kwargs)
          if "bounds" not in kwargs:
              warnings.warn(bounds_warning, UserWarning)
          return ivimmodel_vp
  
      else:
          opt_msg = "The fit_method option chosen was not correct. "
          opt_msg += "Using fit_method: TRR instead..."
          warnings.warn(opt_msg, UserWarning)
          return IvimModelTRR(gtab, **kwargs)
  
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 5 for calling a global function with example usage: ivim_model_selector(gtab, fit_method) and returns: ivimmodel_trr, ivimmodel_vp, IvimModelTRR