Ported twisted/plugin.py to Python3

Fixes https://twistedmatrix.com/trac/ticket/7182