def label_continues_or_empty(seq, previous_label):
    """Returns True if seq continues previous_label or 'O' (that is no new
    tags starting)."""

    seq = list(seq) # copy

    if previous_label.startswith('B-'):
        continuation_label = 'I-' + previous_label[2:]
    elif previous_label.startswith('I-'):
        continuation_label = previous_label
    else:
        continuation_label = 'O'

    while seq and seq[0] == continuation_label:
        seq.pop(0)

    return all(x == 'O' for x in seq)