Refactor reusable parts of the demo app into standalone Python module.

Create a standalone Python module that contains useful constants and utilities
for handling SPF requests and responses.  Refactor the demo app to import and
use this module.