py3 fix: map
py3 fix: metaclass
py3 fix: xrange