Magento 2 Creating a csv file

This post shows you how to create an csv file in a Magento 2 controller and return a download response.