import tweaks for python 3 compatibility
python3 metaclass fix via six
func_code => __code__
isinstance(..., basestring) python3 fix with six.
minor