def METHOD_NAME(self, size):
    with self.lock:
        if self.buf:
            ret = self.buf[:size]
            self.buf = self.buf[size:]
            return ret
        ret = self.ch.get().unpickle()
        if len(ret) > size:
            self.buf = ret[size:]
        return ret[:size]