def calc_offset(previous: tuple, index: int) -> int:
    """
    Function
    ----------
    Given the previous insertions and the current insertion index,
        the necessary offset is calculated

    Paramters
    ----------
    previous : [(int, int),]
        A list of tuples with:
            tuple[0] : previous insertion index
            tuple[1] : length of previous insertion
    index : int
        The location of the current insertion into the list

    Returns
    ----------
    int
        An integer representing the number of slices to offset the insertion

    Notes
    ----------
    When we have multiple nested structures, we need to compute what the
        potential offset is when placing into the sorted list. We cannot do
        this in the original list because then future structures may map to
        a newly inserted structure as opposed to the exterior polygon
    """
    offset = 0
    for item in previous:
        idx, n_pts = item
        if index > idx:
            offset += n_pts
    return offset