'Note: i counts from zero!'

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

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