def _bin_labels_to_segments(bin_labels: list) -> list[tuple]:
    """
    Convert bin labels (time-axis list data) to segment data

    >>> _bin_labels_to_segments(['female'] * 5 + ['male'] * 10 + ['noise'] * 5)
    [('f', 0, 5), ('bbb', 5, 15), ('v', 15, 20)]
    """
    if len(bin_labels) == 0:
        return []

    current_label = None
    segment_start = -1
    ret = []
    i = 0
    for i, e in enumerate(bin_labels):
        if e != current_label:
            if current_label is not None:
                ret.append((current_label, segment_start, i))
            current_label = e
            segment_start = i
    ret.append((current_label, segment_start, i + 1))
    return ret