def METHOD_NAME(self, yaml, yaml_key_list, rewrite_val):
    for key in yaml_key_list:
        if key == yaml_key_list[-1]:
            yaml[key] = rewrite_val
            break
        key = yaml_key_list.pop(0)
        if isinstance(yaml, list):
            yaml[int(key)] = self.METHOD_NAME(yaml[int(key)], yaml_key_list, rewrite_val)
        else:
            yaml[key] = self.METHOD_NAME(yaml.get(key, {}), yaml_key_list, rewrite_val)
    return yaml