def get_contigous_borders(indices):
    """
    helper function to derive contiguous borders from a list of indices
    
    Parameters
    ----------
    indicies : all indices at which a certain thing occurs
    
    
    Returns
    -------
    list of groups when the indices starts and ends (note: last element is the real last element of the group _not_ n+1)
    """
    
    r =[ [indices[0]] ]
    prev = r[0][0]

    for ix,i in enumerate(indices):

        # distance bw last occurence and current > 1
        # then there is obviously a space
        if (i - prev) > 1:
            # add end
            r[-1].append(indices[ix-1])
            # add new start
            r.append([ indices[ix] ])

        prev = i

    r[-1].append( indices[-1] )
    
    return r