def _update_segmentation_mask(segmentation_mask, onset_fronts, offset_fronts, onset_front_id, offset_front_id_most_overlap):
<EOL>onset_front_overlap, offset_front_overlap = _get_consecutive_and_overlapping_fronts(onset_fronts, offset_fronts, onset_front_id, offset_front_id_most_overlap)<EOL>onset_front = _get_front_idxs_from_id(onset_fronts, onset_front_id)<EOL>offset_front = _get_front_idxs_from_id(offset_fronts, offset_front_id_most_overlap)<EOL>msg = "<STR_LIT>".format(<EOL>onset_front, offset_front, onset_front_overlap, offset_front_overlap<EOL>)<EOL>assert onset_front_overlap, msg<EOL>assert offset_front_overlap, msg<EOL>onset_front = onset_front_overlap<EOL>offset_front = offset_front_overlap<EOL>flow_on, _slow_on = onset_front[<NUM_LIT:0>]<EOL>fhigh_on, _shigh_on = onset_front[-<NUM_LIT:1>]<EOL>flow_off, _slow_off = offset_front[<NUM_LIT:0>]<EOL>fhigh_off, _shigh_off = offset_front[-<NUM_LIT:1>]<EOL>flow = max(flow_on, flow_off)<EOL>fhigh = min(fhigh_on, fhigh_off)<EOL>for fidx, _freqchan in enumerate(segmentation_mask[flow:fhigh + <NUM_LIT:1>, :], start=flow):<EOL><INDENT>assert fidx >= flow, "<STR_LIT>".format(fidx, flow)<EOL>assert (fidx - flow) < len(onset_front), "<STR_LIT>".format(<EOL>fidx, flow, len(onset_front), onset_front<EOL>)<EOL>assert (fidx - flow) < len(offset_front), "<STR_LIT>".format(<EOL>fidx, flow, len(offset_front), offset_front<EOL>)<EOL>_, beg = onset_front[fidx - flow]<EOL>_, end = offset_front[fidx - flow]<EOL>if beg > end:<EOL><INDENT>end, beg = beg, end<EOL><DEDENT>assert end >= beg<EOL>segmentation_mask[fidx, beg:end + <NUM_LIT:1>] = onset_front_id<EOL>onset_fronts[fidx, (beg + <NUM_LIT:1>):(end + <NUM_LIT:1>)] = <NUM_LIT:0><EOL>offset_fronts[fidx, (beg + <NUM_LIT:1>):(end + <NUM_LIT:1>)] = <NUM_LIT:0><EOL><DEDENT>nfreqs_used_in_onset_front = (fidx - flow) + <NUM_LIT:1><EOL>indexes = np.arange(flow, fhigh + <NUM_LIT:1>, <NUM_LIT:1>, dtype=np.int64)<EOL>onset_front_sample_idxs_across_freqs = np.array([s for _, s in onset_front])<EOL>onset_front_sample_idxs_across_freqs_up_to_break = onset_front_sample_idxs_across_freqs[:nfreqs_used_in_onset_front]<EOL>offset_front_sample_idxs_across_freqs = np.array([s for _, s in offset_front])<EOL>offset_front_sample_idxs_across_freqs_up_to_break = offset_front_sample_idxs_across_freqs[:nfreqs_used_in_onset_front]<EOL>offset_fronts[indexes[:nfreqs_used_in_onset_front], offset_front_sample_idxs_across_freqs_up_to_break] = <NUM_LIT:0><EOL>onset_fronts[indexes[:nfreqs_used_in_onset_front], onset_front_sample_idxs_across_freqs_up_to_break] = <NUM_LIT:0><EOL>whole_onset_front_matched = onset_front_id not in np.unique(onset_fronts)<EOL>return whole_onset_front_matched<EOL>
Returns an updated segmentation mask such that the input `segmentation_mask` has been updated by segmenting between
`onset_front_id` and `offset_front_id`, as found in `onset_fronts` and `offset_fronts`, respectively.

This function also returns the onset_fronts and offset_fronts matrices, updated so that any fronts that are of
less than 3 channels wide are removed.

This function also returns a boolean value indicating whether the onset channel went to completion.

Specifically, segments by doing the following:

- Going across frequencies in the onset_front,
- add the segment mask ID (the onset front ID) to all samples between the onset_front and the offset_front,
  if the offset_front is in that frequency.

Possible scenarios:

Fronts line up completely:

::

    |   |       S S S
    |   |  =>   S S S
    |   |       S S S
    |   |       S S S

Onset front starts before offset front:

::

    |           |
    |   |       S S S
    |   |  =>   S S S
    |   |       S S S

Onset front ends after offset front:

::

    |   |       S S S
    |   |  =>   S S S
    |   |       S S S
    |           |

Onset front starts before and ends after offset front:

::

    |           |
    |   |  =>   S S S
    |   |       S S S
    |           |

The above three options in reverse:

::

        |       |S S|           |
    |S S|       |S S|       |S S|
    |S S|       |S S|       |S S|
    |S S|           |           |

There is one last scenario:

::

    |   |
    \   /
     \ /
     / \
    |   |

Where the offset and onset fronts cross one another. If this happens, we simply
reverse the indices and accept:

::

    |sss|
    \sss/
     \s/
     /s\
    |sss|

The other option would be to destroy the offset front from the crossover point on, and
then search for a new offset front for the rest of the onset front.