Add a utility function for chaining nested setdefault calls.

Several parts of the diff code built deeply nested dictionaries through
awkwardly formatted setdefault calls. This was hard to make both
PEP-8-compliant and readable, and wasn't the nicest way of going about
it.

This introduces a new utility function that takes variable arguments of
keys, and builds out the nested dictionaries. It then sets the last to
be a list, as needed by the diff code for the property storage.