code: def get_inv_matvec(M, hermitian=False, tol=0):
      if isdense(M):
          return LuInv(M).matvec
      elif isspmatrix(M):
          M = _fast_spmatrix_to_csc(M, hermitian=hermitian)
          return SpLuInv(M).matvec
      else:
          return IterInv(M, tol=tol).matvec
  
imports: from __future__ import division, print_function, absolute_import
  from .None import _arpack
  import numpy
  import warnings
  from scipy.sparse.linalg.interface import aslinearoperator, LinearOperator
  from scipy.sparse import eye, issparse, isspmatrix, isspmatrix_csr
  from scipy.linalg import eig, eigh, lu_factor, lu_solve
  from scipy.sparse.sputils import isdense
  from scipy.sparse.linalg import gmres, splu
  from scipy._lib._util import _aligned_zeros
  from scipy._lib._threadsafety import ReentrancyLock
label_desc: Use image node_id 5 for calling a global function with example usage: get_inv_matvec(M, hermitian, tol) and returns: LuInv, SpLuInv, IterInv