def split_by_pivot(arr, pivots):
    """
    Takes a numpy array and splits it according to pivot points.
    Yields each slice.
    Examples:
    split_by_pivot([0,1,2,3,4,5], [2]) => [[0,1],[2,3,4,5]]
    split_by_pivot([0,1,2,3,4,5], [2,4]) => [[0,1],[2,3],[4,5]]

    Parameters
    ----------
    arr : any sliceable iterable
        The array to return slice froms
    pivots : iterable of ints
        The pivot points to split at
    """
    idxs = [0] + list(pivots) + [len(arr)]
    for start, end in zip(idxs[:-1], idxs[1:]):
        yield arr[start:end]
