'Returns a list of irreducible factors of ``f``.
Examples
>>> from sympy import Poly
>>> from sympy.abc import x, y
>>> f = 2*x**5 + 2*x**4*y + 4*x**3 + 4*x**2*y + 2*x + 2*y
>>> Poly(f).factor_list()
(2, [(Poly(x + y, x, y, domain=\'ZZ\'), 1),
(Poly(x**2 + 1, x, y, domain=\'ZZ\'), 2)])'

def factor_list(f):

    if hasattr(f.rep, 'factor_list'):
        try:
            (coeff, factors) = f.rep.factor_list()
        except DomainError:
            return (S.One, [(f, 1)])
    else:
        raise OperationNotSupported(f, 'factor_list')
    return (f.rep.dom.to_sympy(coeff), [(f.per(g), k) for (g, k) in factors])
