def deep_update(source, overrides):
for key, value in overrides.items():<EOL><INDENT>if isinstance(value, collections.Mapping) and value:<EOL><INDENT>returned = deep_update(source.get(key, {}), value)<EOL>source[key] = returned<EOL><DEDENT>else:<EOL><INDENT>source[key] = overrides[key]<EOL><DEDENT><DEDENT>return source<EOL>
Update a nested dictionary or similar mapping.

    Modify ``source`` in place.

    :type source: collections.Mapping
    :type overrides: collections.Mapping
    :rtype: collections.Mapping