Modified socks.py for Python3