def update_line(line, word, new_word):
    """Update the line by changing word by new_word."""
    global notebook_updated
    notebook_updated = True
    if word.isupper():
        new_word = new_word.upper()
    newline = line.replace(word, new_word)
    return newline
