def _interleave(a, b):
    """Interleave arrays a and b; b may have multiple columns and must be
    shorter by 1.
    """
    b = np.column_stack([b]) # Turn b into a column array.
    nx, ny = b.shape
    c = np.zeros((nx + 1, ny + 1))
    c[:, 0] = a
    c[:-1, 1:] = b
    return c.ravel()[:-(c.shape[1] - 1)]
Interleave arrays a and b; b may have multiple columns and must be
    shorter by 1.