def METHOD_NAME(index, character):
    if not raise_on_unexpected: # not raising, so we dump the buffer into output and append this character
        output.extend(multibyte_buffer)
        multibyte_buffer.clear()
        output.append(character)
        nonlocal is_in_multibyte
        is_in_multibyte = False
        nonlocal multibytes_expected
        multibytes_expected = 0
    else:
        raise ValueError(f"Expected multibyte continuation at index: {index}")