'Returns GCD of ``f`` and ``g`` and their cofactors.'

def cofactors(f, g):

    (lev, dom, per, F, G) = f.unify(g)
    (h, cff, cfg) = dmp_inner_gcd(F, G, lev, dom)
    return (per(h), per(cff), per(cfg))
