def patch(attrs, updates):
orig = {}<EOL>for attr, value in updates:<EOL><INDENT>orig[attr] = attrs[attr]<EOL>attrs[attr] = value<EOL><DEDENT>return orig<EOL>
Perform a set of updates to a attribute dictionary, return the original values.