code: def update_dict(d, u):
      
      for key, val in u.items():
          if isinstance(val, collections.Mapping):
              d[key] = update_dict(d.get(key, {}), val)
          else:
              d[key] = u[key]
      return d
docs: Recursively updates nested dict d from nested dict u