changed func_name with __name__

This is explicitly `xrange` since our main target is python2.7.