def update(self, new_dict: Union[dict, "Config"], allow_add_new_key=True, stop_recursive_update=None):
        """
        Update this dict with extra configs
        :param new_dict: extra configs
        :param allow_add_new_key: whether allowing to add new keys to existing configs or not
        :param stop_recursive_update: Deep update and recursive-check will NOT be applied to keys in stop_recursive_update
        """
        new_dict = new_dict or dict()
        if len(new_dict) == 0:
            return self
        stop_recursive_update = stop_recursive_update or []
        new_dict = copy.deepcopy(new_dict)
        if not allow_add_new_key:
            old_keys = set(self._config)
            new_keys = set(new_dict)
            diff = new_keys.difference(old_keys)
            if len(diff) > 0:
                raise KeyError(
                    "'{}' does not exist in existing config. "
                    "Please use config.update(...) to update the config. Existing keys: {}.".format(
                        diff, self._config.keys()
                    )
                )
        for k, v in new_dict.items():
            if k not in self:
                if isinstance(v, dict):
                    v = Config(v)
                self._config[k] = v  # Placeholder
            success = False
            if isinstance(self._config[k], (dict, Config)):
                if k not in stop_recursive_update:
                    success = self._update_dict_item(k, v, allow_add_new_key)
                else:
                    self._set_item(k, v, allow_add_new_key)
                    success = True
            if not success:
                self._update_single_item(k, v, allow_add_new_key)
            if k in self._config and not hasattr(self, k):
                self.__setattr__(k, self._config[k])
        return self

        Update this dict with extra configs
        :param new_dict: extra configs
        :param allow_add_new_key: whether allowing to add new keys to existing configs or not
        :param stop_recursive_update: Deep update and recursive-check will NOT be applied to keys in stop_recursive_update
        
metadrive/utils/config.py