'Convert a fraction field element to another fraction field.
Examples
>>> from sympy.polys.polyclasses import DMF
>>> from sympy.polys.domains import ZZ, QQ
>>> from sympy.abc import x
>>> f = DMF(([ZZ(1), ZZ(2)], [ZZ(1), ZZ(1)]), ZZ)
>>> QQx = QQ.old_frac_field(x)
>>> ZZx = ZZ.old_frac_field(x)
>>> QQx.from_FractionField(f, ZZx)
(x + 2)/(x + 1)'

def from_FractionField(K1, a, K0):

    if (K1.gens == K0.gens):
        if (K1.dom == K0.dom):
            return a
        else:
            return K1((a.numer().convert(K1.dom).rep, a.denom().convert(K1.dom).rep))
    elif set(K0.gens).issubset(K1.gens):
        (nmonoms, ncoeffs) = _dict_reorder(a.numer().to_dict(), K0.gens, K1.gens)
        (dmonoms, dcoeffs) = _dict_reorder(a.denom().to_dict(), K0.gens, K1.gens)
        if (K1.dom != K0.dom):
            ncoeffs = [K1.dom.convert(c, K0.dom) for c in ncoeffs]
            dcoeffs = [K1.dom.convert(c, K0.dom) for c in dcoeffs]
        return K1((dict(zip(nmonoms, ncoeffs)), dict(zip(dmonoms, dcoeffs))))
