How to use Python script in HTML in Flask?

You embed Python code with HTML in Flask like this:

from app import app@app.route('/')@app.route('/index')def index():    user = {'username': 'Miguel'}    return '''<html>    <head>        <title>Home Page - Microblog</title>    </head>    <body>        <h1>Hello, ''' + user['username'] + '''!</h1>    </body></html>'''