code: def _verify_invertible(M, iszerofunc=_iszero):
      """Initial check to see if a matrix is invertible. Raises or returns
      determinant for use in _inv_ADJ."""
  
      if not M.is_square:
          raise NonSquareMatrixError(
              "A Matrix must be square to invert."
          )
  
      d = M.det(method="berkowitz")
      zero = d.equals(0)
  
      if (
          zero is None
      ):  # if equals() can't decide, will rref be able to?
          ok = M.rref(simplify=True)[0]
          zero = any(iszerofunc(ok[j, j]) for j in range(ok.rows))
  
      if zero:
          raise NonInvertibleMatrixError(
              "Matrix det == 0; not invertible."
          )
  
      return d
  
file_path: sympy/sympy/matrices/inverse.py
imports: from sympy.polys.matrices.exceptions import DMNonInvertibleMatrixError
  from sympy.polys.domains import EX
  from .exceptions import MatrixError, NonSquareMatrixError, NonInvertibleMatrixError
  from .utilities import _iszero
label_desc: Use image node_id 5 for calling a global function with example usage: _verify_invertible(M, iszerofunc) and returns: d