def _next_method(self):
        """Read the next method from the source and process it

        Once one complete method has been assembled, it is placed in the internal queue. This
        method will block until a complete `Method` has been constructed, which may consist of one
        or more frames.
        """
        while not self.method_queue:
            # keep reading frames until we have at least one complete method in the queue
            try:
                frame = self.transport.read_frame()
            except Exception as exc:
                # connection was closed? framing error?
                if six.PY2:
                    _, _, tb = sys.exc_info()
                    exc.tb = tb
                self.method_queue.append(exc)
                break

            self.frames_recv += 1

            if frame.frame_type not in (self.expected_types[frame.channel], 8):
                msg = 'Received frame type {} while expecting type: {}' \
                    .format(frame.frame_type, self.expected_types[frame.channel])
                self.method_queue.append(UnexpectedFrame(msg, channel_id=frame.channel))
            elif frame.frame_type == FrameType.METHOD:
                self._process_method_frame(frame)
            elif frame.frame_type == FrameType.HEADER:
                self._process_content_header(frame)
            elif frame.frame_type == FrameType.BODY:
                self._process_content_body(frame)
dataset/ETHPy150Open veegee/amqpy/amqpy/method_io.py/MethodReader._next_method/original