def get_segments_between_pivots(segments, pivots):
    """
    Graps the segments between two pivots.

    Parameters
    ----------
    segments : list of BoundarySegment
        The segments.
    pivots : list of int
        The indices of the pivot points.

    Returns
    -------
    segments : list of int
        The indices of the segments between the pivots.
    """
    k, n = pivots
    if k < n:
        return list(range(k, n))
    else:  # edge case
        segments_pivots = list(range(k, len(segments)))
        segments_pivots.extend(range(0, n))
        return segments_pivots