def handle_404(_, response, exception):
 logging.exception(exception)
 response.set_status(404)
 response.write(jinja_environment.get_template('404.html').render())

def handle_404 ( _ , response , exception ) : logging . exception ( exception ) response . set_status ( 404 ) response . write ( jinja_environment . get_template ( '404.html' ) . render ( ) )
handles 404 .