Port fixes for listShares API in python2 to python3