code: def _find_reasonable_pivot(
      col, iszerofunc=_iszero, simpfunc=_simplify
  ):
      """Find the lowest index of an item in ``col`` that is
      suitable for a pivot.  If ``col`` consists only of
      Floats, the pivot with the largest norm is returned.
      Otherwise, the first element where ``iszerofunc`` returns
      False is used.  If ``iszerofunc`` does not return false,
      items are simplified and retested until a suitable
      pivot is found.
  
      Returns a 4-tuple
          (pivot_offset, pivot_val, assumed_nonzero, newly_determined)
      where pivot_offset is the index of the pivot, pivot_val is
      the (possibly simplified) value of the pivot, assumed_nonzero
      is True if an assumption that the pivot was non-zero
      was made without being proved, and newly_determined are
      elements that were simplified during the process of pivot
      finding."""
  
      newly_determined = []
      col = list(col)
      # a column that contains a mix of floats and integers
      # but at least one float is considered a numerical
      # column, and so we do partial pivoting
      if all(isinstance(x, (Float, Integer)) for x in col) and any(
          isinstance(x, Float) for x in col
      ):
          col_abs = [abs(x) for x in col]
          max_value = max(col_abs)
          if iszerofunc(max_value):
              # just because iszerofunc returned True, doesn't
              # mean the value is numerically zero.  Make sure
              # to replace all entries with numerical zeros
              if max_value != 0:
                  newly_determined = [
                      (i, 0) for i, x in enumerate(col) if x != 0
                  ]
              return (None, None, False, newly_determined)
          index = col_abs.index(max_value)
          return (index, col[index], False, newly_determined)
  
      # PASS 1 (iszerofunc directly)
      possible_zeros = []
      for i, x in enumerate(col):
          is_zero = iszerofunc(x)
          # is someone wrote a custom iszerofunc, it may return
          # BooleanFalse or BooleanTrue instead of True or False,
          # so use == for comparison instead of `is`
          if is_zero == False:
              # we found something that is definitely not zero
              return (i, x, False, newly_determined)
          possible_zeros.append(is_zero)
  
      # by this point, we've found no certain non-zeros
      if all(possible_zeros):
          # if everything is definitely zero, we have
          # no pivot
          return (None, None, False, newly_determined)
  
      # PASS 2 (iszerofunc after simplify)
      # we haven't found any for-sure non-zeros, so
      # go through the elements iszerofunc couldn't
      # make a determination about and opportunistically
      # simplify to see if we find something
      for i, x in enumerate(col):
          if possible_zeros[i] is not None:
              continue
          simped = simpfunc(x)
          is_zero = iszerofunc(simped)
          if is_zero in (True, False):
              newly_determined.append((i, simped))
          if is_zero == False:
              return (i, simped, False, newly_determined)
          possible_zeros[i] = is_zero
  
      # after simplifying, some things that were recognized
      # as zeros might be zeros
      if all(possible_zeros):
          # if everything is definitely zero, we have
          # no pivot
          return (None, None, False, newly_determined)
  
      # PASS 3 (.equals(0))
      # some expressions fail to simplify to zero, but
      # ``.equals(0)`` evaluates to True.  As a last-ditch
      # attempt, apply ``.equals`` to these expressions
      for i, x in enumerate(col):
          if possible_zeros[i] is not None:
              continue
          if x.equals(S.Zero):
              # ``.iszero`` may return False with
              # an implicit assumption (e.g., ``x.equals(0)``
              # when ``x`` is a symbol), so only treat it
              # as proved when ``.equals(0)`` returns True
              possible_zeros[i] = True
              newly_determined.append((i, S.Zero))
  
      if all(possible_zeros):
          return (None, None, False, newly_determined)
  
      # at this point there is nothing that could definitely
      # be a pivot.  To maintain compatibility with existing
      # behavior, we'll assume that an illdetermined thing is
      # non-zero.  We should probably raise a warning in this case
      i = possible_zeros.index(None)
      return (i, col[i], True, newly_determined)
  
imports: from types import FunctionType
  from sympy.core.cache import cacheit
  from sympy.core.numbers import Float, Integer
  from sympy.core.singleton import S
  from sympy.core.symbol import uniquely_named_symbol
  from sympy.core.mul import Mul
  from sympy.polys import PurePoly, cancel
  from sympy.functions.combinatorial.numbers import nC
  from sympy.polys.matrices.domainmatrix import DomainMatrix
  from sympy.polys.matrices.ddm import DDM
  from .exceptions import NonSquareMatrixError
  from .utilities import _get_intermediate_simp, _get_intermediate_simp_bool, _iszero, _is_zero_after_expand_mul, _dotprodsimp, _simplify
label_desc: Use image node_id 1 for calling a global function with example usage: _find_reasonable_pivot(col, iszerofunc, simpfunc) and returns: i,  col,  True,  newly_determined, index,  col,  False,  newly_determined, None,  None,  False,  newly_determined, None,  None,  False,  newly_determined, None,  None,  False,  newly_determined, None,  None,  False,  newly_determined, i,  x,  False,  newly_determined, i,  simped,  False,  newly_determined