def get_contigous_borders(indices):
    '\n    helper function to derive contiguous borders from a list of indices\n    \n    Parameters\n    ----------\n    indicies : all indices at which a certain thing occurs\n    \n    \n    Returns\n    -------\n    list of groups when the indices starts and ends (note: last element is the real last element of the group _not_ n+1)\n    '
    r = [[indices[0]]]
    prev = r[0][0]
    for (ix, i) in enumerate(indices):
        if ((i - prev) > 1):
            r[(- 1)].append(indices[(ix - 1)])
            r.append([indices[ix]])
        prev = i
    r[(- 1)].append(indices[(- 1)])
    return r
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)
def get_contigous_borders(indices):
    '\n    helper function to derive contiguous borders from a list of indices\n    \n    Parameters\n    ----------\n    indicies : all indices at which a certain thing occurs\n    \n    \n    Returns\n    -------\n    list of groups when the indices starts and ends (note: last element is the real last element of the group _not_ n+1)\n    '
    r = [[indices[0]]]
    prev = r[0][0]
    for (ix, i) in enumerate(indices):
        if ((i - prev) > 1):
            r[(- 1)].append(indices[(ix - 1)])
            r.append([indices[ix]])
        prev = i
    r[(- 1)].append(indices[(- 1)])
    return r