rewriting ssh 6.6 to python