def dmp_sqf_norm(f, u, K):
    if not u:
        return dup_sqf_norm(f, K)

    if not K.is_Algebraic:
        raise DomainError("ground domain must be algebraic")

    g = dmp_raise(K.mod.rep, u + 1, 0, K.dom)
    F = dmp_raise([K.one, -K.unit], u, 0, K)

    s = 0

    while True:
        h, _ = dmp_inject(f, u, K, front=True)
        r = dmp_resultant(g, h, u + 1, K.dom)

        if dmp_sqf_p(r, u, K.dom):
            break
        else:
            f, s = dmp_compose(f, F, u, K), s + 1

    return s, f, r
Square-free norm of ``f`` in ``K[X]``, useful over algebraic domains.
dataset/ETHPy150Open sympy/sympy/sympy/polys/sqfreetools.py/dmp_sqf_norm