Update spws.py

updated for python 3