'Returns a list of square-free factors of ``f``.
Examples
>>> from sympy import Poly
>>> from sympy.abc import x
>>> f = 2*x**5 + 16*x**4 + 50*x**3 + 76*x**2 + 56*x + 16
>>> Poly(f).sqf_list()
(2, [(Poly(x + 1, x, domain=\'ZZ\'), 2),
(Poly(x + 2, x, domain=\'ZZ\'), 3)])
>>> Poly(f).sqf_list(all=True)
(2, [(Poly(1, x, domain=\'ZZ\'), 1),
(Poly(x + 1, x, domain=\'ZZ\'), 2),
(Poly(x + 2, x, domain=\'ZZ\'), 3)])'

def sqf_list(f, all=False):

    if hasattr(f.rep, 'sqf_list'):
        (coeff, factors) = f.rep.sqf_list(all)
    else:
        raise OperationNotSupported(f, 'sqf_list')
    return (f.rep.dom.to_sympy(coeff), [(f.per(g), k) for (g, k) in factors])
