'Convert a ``DMF`` object to ``dtype``.'

def from_GlobalPolynomialRing(K1, a, K0):

    if (K1.gens == K0.gens):
        if (K1.dom == K0.dom):
            return K1(a.rep)
        else:
            return K1(a.convert(K1.dom).rep)
    else:
        (monoms, coeffs) = _dict_reorder(a.to_dict(), K0.gens, K1.gens)
        if (K1.dom != K0.dom):
            coeffs = [K1.dom.convert(c, K0.dom) for c in coeffs]
        return K1(dict(zip(monoms, coeffs)))
