def poly_between(x, ylower, yupper):
    """
    Given a sequence of *x*, *ylower* and *yupper*, return the polygon
    that fills the regions between them.  *ylower* or *yupper* can be
    scalar or iterable.  If they are iterable, they must be equal in
    length to *x*.

    Return value is *x*, *y* arrays for use with
    :meth:`matplotlib.axes.Axes.fill`.
    """
    if ma.isMaskedArray(ylower) or ma.isMaskedArray(yupper) or ma.isMaskedArray(x):
        nx = ma
    else:
        nx = np

    Nx = len(x)
    if not cbook.iterable(ylower):
        ylower = ylower*nx.ones(Nx)

    if not cbook.iterable(yupper):
        yupper = yupper*nx.ones(Nx)

    x = nx.concatenate( (x, x[::-1]) )
    y = nx.concatenate( (yupper, ylower[::-1]) )
    return x,y