Make pywemo work in Python 2.7

Changes should be forwards compatible with Python 3.