code: def _try_DM(M, use_EX=False):
      """Try to convert a matrix to a ``DomainMatrix``."""
      dM = M.to_DM()
      K = dM.domain
  
      # Return DomainMatrix if a domain is found. Only use EX if use_EX=True.
      if not use_EX and K.is_EXRAW:
          return None
      elif K.is_EXRAW:
          return dM.convert_to(EX)
      else:
          return dM
  
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 12 for calling a global function with example usage: _try_DM(M, use_EX) and returns: None, dM, dM