[python3] Metaclass support for Python2 and Python3