def add_notation(tags_segment, label, left_context, right_context,
    tagging_notation='BILOU'):
    """Receive segment of tagged tokens and return list of labeled tokens"""
    labels = []
    if tagging_notation == 'BIO':
        for offset in range(0, len(tags_segment)):
            if offset < left_context:
                token_label = 'O'
            elif offset == left_context:
                token_label = 'B-' + label
            elif offset < len(tags_segment) - right_context:
                token_label = 'I-' + label if label else label
            else:
                token_label = 'O'
            labels.append(token_label)
    if tagging_notation == 'BILOU':
        for offset in range(0, len(tags_segment)):
            if offset < left_context:
                token_label = 'O'
            elif offset == left_context and len(tags_segment
                ) - left_context - right_context == 1:
                token_label = 'U-' + label if label else label
            elif offset == left_context:
                token_label = 'B-' + label
            elif offset < len(tags_segment) - right_context - 1:
                token_label = 'I-' + label if label else label
            elif offset < len(tags_segment) - right_context:
                token_label = 'L-' + label if label else label
            else:
                token_label = 'O'
            labels.append(token_label)
    return labels
