refactor tcpserver to follow by pep8 style guide