The full guide for creating and understanding this application is available on Twilio's Developer Voices blog.
To install, you'll want a virtual environment with the following:
$ mkdir sendgrid-newsletter
$ cd sendgrid-newsletter
$ python3 -m venv sendgrid-newsletter
$ source sendgrid-newsletter/bin/activate
(sendgrid-newsletter) $ pip install -r requirements.txt
Also, make sure you've followed the SendGrid integration steps for Python, available on your Twilio Sendgrid account.