py3: make contrib/debugshell.py work with Python 3

Authored by pulkit.

Description

py3: make contrib/debugshell.py work with Python 3

I changed default mercurial installation of my personal laptop to one installed
with python 3.7. debugshell is one of the extension which I have enabled and it
was failing. This patch makes debugshell works with Python 3.

I found that chg does not work with python 3.

Differential Revision: https://phab.mercurial-scm.org/D6031

Details