def recv(self):
        """wait for python data from the sending party and return it"""
        (expected,) = struct.unpack('I', os.read(self._fd_r, self.SZI))
        sdata = ""
        while 1:
            sdata += os.read(self._fd_r, expected - len(sdata))
            assert len(sdata) <= expected
            if len(sdata) == expected:
                break
        return pickle.loads(sdata)
wait for python data from the sending party and return it
recipes/Python/576520_Multithreaded_MultiplexerDemultiplexer_allow/recipe-576520.py