Works like dict.update(dict) but handles nested dicts.
            From http://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth.

def update(self, u):
        ''' Works like dict.update(dict) but handles nested dicts.
            From http://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth.
        '''
        for k, v in u.iteritems():
            if isinstance(v, collections.Mapping):
                r = nested_dict.from_dict(self.get(k, {}))
                r.update(v)
                self[k] = r
            elif isinstance(self, collections.Mapping):
                self[k] = u[k]
            else:
                self.__dict__ = dict(k = u[k])