Fix ssh tunnel for Python3

`xrange` was unrecognized.
Merge pull request #5994 from Zaharid/2.x

Fix ssh tunnel for Python3