Fixed some lexical errors reported by pyflake

According to pyflake3 *ttws* should even be Python 3 compliant now.