python3: Replace file and _fileobject

Use io.IOBase instead of file and socket.SocketIO instead of
socket._fileobject