Support Python 3

Switched to using a metaclass syntax which works in both versions, and wrapped classdict in a dict() call since it gets passed in as an immutable proxy object...