code: def _to_domain(m, domain=None):
      """Convert Matrix to DomainMatrix"""
      # XXX: deprecated support for RawMatrix:
      ring = getattr(m, "ring", None)
      m = m.applyfunc(
          lambda e: e.as_expr() if isinstance(e, Poly) else e
      )
  
      dM = DomainMatrix.from_Matrix(m)
  
      domain = domain or ring
      if domain is not None:
          dM = dM.convert_to(domain)
      return dM
  
file_path: sympy/sympy/matrices/normalforms.py
imports: from sympy.polys.domains.integerring import ZZ
  from sympy.polys.polytools import Poly
  from sympy.polys.matrices import DomainMatrix
  from sympy.polys.matrices.normalforms import smith_normal_form, invariant_factors, hermite_normal_form
label_desc: Use image node_id 1 for calling a global function with example usage: _to_domain(m, domain) and returns: dM