port client script to python 3