def perron(target):
    """
    Return True if target is irreducible, False if reducible
    or None if undecidable.

    Perron's criterion is the following.  Let f = \sum a_i X^i be a
    monic integer coefficient polynomial.  Then, if one of the
    following conditions holds, f is irreducible.
    (1) |a{n-1}| > 1 + \sum_{i=0}^{n-2} |ai|,
    (2) |a{n-1}| >= 1 + \sum_{i=0}^{n-2} |ai| and f(1) nor f(-1) isn't zero.
    """
    # precondition
    if target.leading_coefficient() != 1:
        return None

    # the criterion
    degree = target.degree()
    rhs = 1 + sum(abs(c) for (d, c) in target if d < degree - 1)
    # (1)
    if abs(target[degree - 1]) > rhs:
        return True
    # (2)
    elif abs(target[degree - 1]) >= rhs and target(1) != 0 and target(-1) != 0:
        return True

    # undecided
    return None