code: def _DM(lol, typ, K):
      """Make a DM of type typ over K from lol."""
      A = DM(lol, K)
  
      if typ == "DDM":
          return A.to_ddm()
      elif typ == "SDM":
          return A.to_sdm()
      elif typ == "DFM":
          if GROUND_TYPES != "flint":
              skip("DFM not supported in this ground type")
          return A.to_dfm()
      else:
          assert False, "Unknown type %s" % typ
  
imports: from sympy.external.gmpy import GROUND_TYPES
  from sympy import ZZ, QQ, GF, ZZ_I, symbols
  from sympy.polys.matrices.exceptions import DMBadInputError, DMDomainError, DMNonSquareMatrixError, DMNonInvertibleMatrixError, DMShapeError
  from sympy.polys.matrices.domainmatrix import DM, DomainMatrix, DDM, SDM, DFM
  from sympy.testing.pytest import raises, skip
  import pytest
label_desc: Use image node_id 5 for calling a global function with example usage: _DM(lol, typ, K) and returns: A, A, A