human
Give me a Python code to compute    P(b    <=    Z    <=    a)    where    Z    ~    Poisson(p)    and\n                                                `interval    =    (b,    a)` given the following:
I wrote the below code

    if ((alpha <= 0) or (alpha >= 1)):
        raise ValueError('alpha    must    be    in    (0,    1),    bounds    excluded')
    counts = np.array(counts, dtype=np.float)
    if (counts < 0).any():
        raise ValueError('counts    must    be    >=    0')
    n = counts.sum()
    k = len(counts)
    proportions = (counts / n)
    if (method == 'goodman'):
        chi2 = stats.chi2.ppf((1 - (alpha / k)), 1)
        delta = ((chi2 ** 2) + ((((4 * n) * proportions) * chi2) * (1 - proportions)))
        region = (((((2 * n) * proportions) + chi2) + np.array([(- np.sqrt(delta)), np.sqrt(delta)])) / (2 * (chi2 + n))).T
    elif (method[:5] == 'sison'):
        def poisson_interval(interval, p):
            'Compute    P(b    <=    Z    <=    a)    where    Z    ~    Poisson(p)    and\n                                                `interval    =    (b,    a)`.'
            (b, a) = interval
            prob = (stats.poisson.cdf(a, p) - stats.poisson.cdf((b - 1), p))
            if ((p == 0) and np.isnan(prob)):
                return int(((b - 1) < 0))
            return prob
        def truncated_poisson_factorial_moment(interval, r, p):
            'Compute    mu_r,    the    r-th    factorial    moment    of    a    poisson    random\n                                                variable    of    parameter    `p`    truncated    to    `interval    =    (b,    a)`.'
            (b, a) = interval
            return ((p ** r) * (1 - ((poisson_interval((((a - r) + 1), a), p) - poisson_interval(((b - r), (b - 1)), p)) / poisson_interval((b, a), p))))
        def edgeworth(intervals):
            "Compute    the    Edgeworth    expansion    term    of    Sison    &    Glaz's    formula\n                                                (1)    (approximated    probability    for    multinomial    proportions    in    a\n                                                given    box)."
            (mu_r1, mu_r2, mu_r3, mu_r4) = [np.array([truncated_poisson_factorial_moment(interval, r, p) for (interval, p) in...

What's a good function header?
assistant
#Here is Python code to compute    P(b    <=    Z    <=    a)    where    Z    ~    Poisson(p)    and\n                                                `interval    =    (b,    a)`.

def multinomial_proportions_confint(counts, alpha=0.05, method='goodman'):