code: def _wrap_func(func, xdata, ydata, transform):
      if transform is None:
  
          def func_wrapped(params):
              return func(xdata, *params) - ydata
  
      elif transform.size == 1 or transform.ndim == 1:
  
          def func_wrapped(params):
              return transform * (func(xdata, *params) - ydata)
  
      else:
          # Chisq = (y - yd)^T C^{-1} (y-yd)
          # transform = L such that C = L L^T
          # C^{-1} = L^{-T} L^{-1}
          # Chisq = (y - yd)^T L^{-T} L^{-1} (y-yd)
          # Define (y-yd)' = L^{-1} (y-yd)
          # by solving
          # L (y-yd)' = (y-yd)
          # and minimize (y-yd)'^T (y-yd)'
          def func_wrapped(params):
              return solve_triangular(
                  transform, func(xdata, *params) - ydata, lower=True
              )
  
      return func_wrapped
  
imports: import warnings
  from .None import _minpack
  import numpy
  from numpy import atleast_1d, triu, shape, transpose, zeros, prod, greater, asarray, inf, finfo, inexact, issubdtype, dtype
  from scipy import linalg
  from scipy.linalg import svd, cholesky, solve_triangular, LinAlgError
  from scipy._lib._util import _asarray_validated, _lazywhere, _contains_nan
  from scipy._lib._util import getfullargspec_no_self
  from ._optimize import OptimizeResult, _check_unknown_options, OptimizeWarning
  from ._lsq import least_squares
  from ._lsq.least_squares import prepare_bounds
  from scipy.optimize._minimize import Bounds
  from numpy import dot, eye, take
  from numpy.linalg import inv
label_desc: Use image node_id 6 for calling a global function with example usage: _wrap_func(func, xdata, ydata, transform) and returns: func_wrapped, unknown, unknown, solve_triangular