def _reap_msg_frames(self, method_frame):
        '''
        Support method to reap header frame and body from current frame buffer.
        Used in processing of basic.return, basic.deliver, and basic.get_ok.
        Will return a pair (<header frame>, <body>), or re-queue current frames
        and raise a FrameUnderflow.

        :returns: pair (<header frame>, <body>)
        :rtype: tuple of (HeaderFrame, bytearray)
        '''
        # No need to assert that is instance of Header or Content frames
        # because failure to access as such will result in exception that
        # channel will pick up and handle accordingly.
        header_frame = self.channel.next_frame()
        if header_frame:
            size = header_frame.size
            body = bytearray()
            rbuf_frames = deque([header_frame, method_frame])

            while len(body) < size:
                content_frame = self.channel.next_frame()
                if content_frame:
                    rbuf_frames.appendleft(content_frame)
                    body.extend(content_frame.payload.buffer())
                else:
                    self.channel.requeue_frames(rbuf_frames)
                    raise self.FrameUnderflow()
        else:
            self.channel.requeue_frames([method_frame])
            raise self.FrameUnderflow()

        return (header_frame, body)
def _reap_msg_frames ( self , method_frame ) : header_frame = self . channel . next_frame ( ) if header_frame : size = header_frame . size body = bytearray ( ) rbuf_frames = deque ( [ header_frame , method_frame ] ) while len ( body ) < size : content_frame = self . channel . next_frame ( ) if content_frame : rbuf_frames . appendleft ( content_frame ) body . extend ( content_frame . payload . buffer ( ) ) else : self . channel . requeue_frames ( rbuf_frames ) raise self . FrameUnderflow ( ) else : self . channel . requeue_frames ( [ method_frame ] ) raise self . FrameUnderflow ( ) return ( header_frame , body )
Support method to reap header frame and body from current frame buffer.
        Used in processing of basic.return, basic.deliver, and basic.get_ok.
        Will return a pair (<header frame>, <body>), or re-queue current frames
        and raise a FrameUnderflow.

        :returns: pair (<header frame>, <body>)
        :rtype: tuple of (HeaderFrame, bytearray)