code: def smith_normal_form(m, domain=None):
      """
      Return the Smith Normal Form of a matrix `m` over the ring `domain`.
      This will only work if the ring is a principal ideal domain.
  
      Examples
      ========
  
      >>> from sympy import Matrix, ZZ
      >>> from sympy.matrices.normalforms import smith_normal_form
      >>> m = Matrix([[12, 6, 4], [3, 9, 6], [2, 16, 14]])
      >>> print(smith_normal_form(m, domain=ZZ))
      Matrix([[1, 0, 0], [0, 10, 0], [0, 0, -30]])
  
      """
      dM = _to_domain(m, domain)
      return _snf(dM).to_Matrix()
  
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 2 for calling a global function with example usage: smith_normal_form(m, domain) and returns: _snf