def _tokenizer(data):
    """Yield structural and non-structural slices from data"""
    last = 0
    for idx, i in enumerate(data):
        if i in '(,)':
            if idx - last > 0:
                yield data[last:idx]
            yield i
            last = idx + 1
    if data[-1] != ';':
        raise ValueError('Newick string is not semicolon terminated')
    if idx - last > 0:
        yield data[last:idx]
    yield data[-1]
