'Note: i counts from zero!'

def __init__(self, ap, bq, i, z):

    (ap, bq, i) = list(map(sympify, [ap, bq, i]))
    self._ap = ap
    self._bq = bq
    self._i = i
    ap = list(ap)
    bq = list(bq)
    ai = (ap.pop(i) - 1)
    if (ai == 0):
        raise ValueError('Cannot    decrement    unit    upper    index.')
    m = Poly((z * ai), _x)
    for a in ap:
        m *= Poly((_x + a), _x)
    A = Dummy('A')
    n = D = Poly(((ai * A) - ai), A)
    for b in bq:
        n *= ((D + b) - 1)
    b0 = (- n.nth(0))
    if (b0 == 0):
        raise ValueError('Cannot    decrement    upper    index:    cancels    with    lower')
    n = Poly(Poly(n.all_coeffs()[:(-1)], A).as_expr().subs(A, ((_x / ai) + 1)), _x)
    self._poly = Poly(((n - m) / b0), _x)
