def _add_var_to_assignment(partial_assignt, ass_vars, new_var, new_value):
    """
    Add a value for a variable in an assignment.
    The given partial assignment is not modified and a new assignement is
    returned, augmented with the value for the new variable, in the right
    position according to `ass_vars`.

    :param partial_assignt: a partial assignment represented as a list of
    values, the order of the values maps the order of the corresponding
    variables in `ass_vars`
    :param ass_vars: a list of variables corresponding to the list to the
    variables whose values are given by `partial_assignt`, augmented with one
    extra variable 'new_var' whose value is given by `new_value`.
    :param new_var: variable that must be added in the assignment
    :param new_value: value to add in the assignement for the new variable

    """
    if len(partial_assignt) + 1 != len(ass_vars):
        raise ValueError(
            'Length of partial assignment and variables do not match.')
    full_assignment = partial_assignt[:]
    for i in range(len(ass_vars)):
        if ass_vars[i] == new_var:
            full_assignment.insert(i, new_value)
    return full_assignment
