Python Flask Basics Character Builder Set a Cookie

Write the code of Learning, but i don't next

@app.route('/save', methods=['POST']) def save(): response = make_response(redirect(url_for('index'))) data = get_saved_data() data.update(dict(request.form.items())) response.set_cookie('treehouse', json.dumps(dict(data))) return response

flask_app.py
from flask import Flask, make_response

app = Flask(__name__)

def get_saved_data():
    try: 
        data = json.loads(request.cookies.get('treehouse'))
    except TypeError:
        data = {}
    return data

@app.route('/')
def index():
    data = get_saved_data()
    return render_template('index.html', saves=data)


@app.route('/save', methods=['POST'])
def save():
    response = make_response(redirect(url_for('index')))
    data = get_saved_data()
    data.update(dict(request.form.items()))
    response.set_cookie('treehouse', 'name')
    return response