Ported twisted/plugin.py to be Python3 compatible syntax

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