code: def smith_normal_form(m):
      """
      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 ZZ
      >>> from sympy.polys.matrices import DomainMatrix
      >>> from sympy.polys.matrices.normalforms import smith_normal_form
      >>> m = DomainMatrix([[ZZ(12), ZZ(6), ZZ(4)],
      ...                   [ZZ(3), ZZ(9), ZZ(6)],
      ...                   [ZZ(2), ZZ(16), ZZ(14)]], (3, 3), ZZ)
      >>> print(smith_normal_form(m).to_Matrix())
      Matrix([[1, 0, 0], [0, 10, 0], [0, 0, -30]])
  
      """
      invs = invariant_factors(m)
      smf = DomainMatrix.diag(invs, m.domain, m.shape)
      return smf
  
file_path: sympy/sympy/polys/matrices/normalforms.py
imports: from collections import defaultdict
  from .domainmatrix import DomainMatrix
  from .exceptions import DMDomainError, DMShapeError
  from sympy.ntheory.modular import symmetric_residue
  from sympy.polys.domains import QQ, ZZ
label_desc: Use image node_id 1 for calling a global function with example usage: smith_normal_form(m) and returns: smf