Replace twill with custom code.
Some easy python3 compatibility changes.