Fix autopkgtest test failures
I was going to go ahead and just upload the package, but decided to open this MR and get feedback from @cjwatson and/or @andrewsh before proceeding. I think it's a good idea to do that because (a) we've just entered Soft Freeze, (b) I'm not very familiar with twisted's code base, and (c) the changes are sizeable.
Let me know what you think. Thanks!