def get_file():
    results = generate_file_data()
generator = (cell for row in results for cell in row)
return Response(generator, mimetype='text/plain', headers={
    'Content-Disposition': 'attachment;filename=test.txt'})
In python using Flask, how can I write out an object for download?