added some code i wrote for a question on #twisted.web