Demo os App Engine Python 2.7 with Background thread joined after writing response. Deploy to App Engine with the command:
gcloud app deploy
Browse to the app
gcloud app browse
Check the logs. Notice that you can write logs to Stackdriver after writing the response to the HTTP stream, even in a different thread.