def append_key(stanzas, left_struc, keypath=None):
    """Get the appropriate key for appending to the sequence ``left_struc``.

    ``stanzas`` should be a diff, some of whose stanzas may modify a
    sequence ``left_struc`` that appears at path ``keypath``.  If any of
    the stanzas append to ``left_struc``, the return value is the
    largest index in ``left_struc`` they address, plus one.
    Otherwise, the return value is ``len(left_struc)`` (i.e. the index
    that a value would have if it was appended to ``left_struc``).

    >>> append_key([], [])
    0
    >>> append_key([[[2], 'Baz']], ['Foo', 'Bar'])
    3
    >>> append_key([[[2], 'Baz'], [['Quux', 0], 'Foo']], [], ['Quux'])
    1

    """
    if keypath is None:
        keypath = []
    addition_key = len(left_struc)
    for stanza in stanzas:
        prior_key = stanza[0]
        if (len(stanza) > 1
            and len(prior_key) == len(keypath) + 1
            and prior_key[-1] >= addition_key):
            addition_key = prior_key[-1] + 1
    return addition_key