code: def check_termination(dF, F, dx_norm, x_norm, ratio, ftol, xtol):
      """Check termination condition for nonlinear least squares."""
      ftol_satisfied = dF < ftol * F and ratio > 0.25
      xtol_satisfied = dx_norm < xtol * (xtol + x_norm)
  
      if ftol_satisfied and xtol_satisfied:
          return 4
      elif ftol_satisfied:
          return 2
      elif xtol_satisfied:
          return 3
      else:
          return None
  
imports: from __future__ import division, print_function, absolute_import
  from math import copysign
  import numpy
  from numpy.linalg import norm
  from scipy.linalg import cho_factor, cho_solve, LinAlgError
  from scipy.sparse import issparse
  from scipy.sparse.linalg import LinearOperator, aslinearoperator
label_desc: Use image node_id 25 for calling a global function with example usage: check_termination(dF, F, dx_norm, x_norm, ratio, ftol, xtol) and returns: int, int, int, None