code: def huber(z, rho, cost_only):
      mask = z <= 1
      rho[0, mask] = z[mask]
      rho[0, ~mask] = 2 * z[~mask] ** 0.5 - 1
      if cost_only:
          return
      rho[1, mask] = 1
      rho[1, ~mask] = z[~mask] ** -0.5
      rho[2, mask] = 0
      rho[2, ~mask] = -0.5 * z[~mask] ** -1.5
  
imports: from warnings import warn
  import numpy
  from numpy.linalg import norm
  from scipy.sparse import issparse
  from scipy.sparse.linalg import LinearOperator
  from scipy.optimize import _minpack, OptimizeResult
  from scipy.optimize._numdiff import approx_derivative, group_columns
  from scipy.optimize._minimize import Bounds
  from .trf import trf
  from .dogbox import dogbox
  from .common import EPS, in_bounds, make_strictly_feasible
label_desc: Use image node_id 6 for calling a global function with example usage: huber(z, rho, cost_only) without return types