def update_keyvalue(input_dict, keys, newvalue):
    """
    Function to update a provided key with a value.
    :param input_dict: YAML dict representation to be updated
    :param keys: list containing one or more keys. 
                    Multiple keys are nested, e.g. input_dict[key1][key2[key3].
    :param newvalue: value to set key to.
    :return: dict
    """
    new_dict = input_dict.copy()

    if len(keys) == 1 and keys[0] in new_dict:
        new_dict[keys[0]] = newvalue
        return new_dict
    else:
        i = 0
        current_dict = new_dict[keys[i]]
        while True:
            if i == len(keys)-2:
                current_dict[keys[i+1]] = newvalue
                return new_dict
            else:
                i = i+1
                current_dict = current_dict[keys[i]]