This is simple and stupid and does little checking.
It generates a TXT type record of the SPF record in tinydns-data format.
All consecutive whitespace gets slurped into a single space, so feel free to use newlines to make long records easy to read.
See http://cr.yp.to/djbdns/tinydns-data.html for more information on the tinydns-data format.
See http://www.openspf.org/SPF_Record_Syntax for more information on the Sender Policy Framework record format.