use one codepath for py2 and py3
fix indentation
Merge pull request #1215 from ContinuumIO/task/gevent

use one codepath for py2 and py3