def _next_method(self):
queue = self.queue<EOL>put = self._quick_put<EOL>read_frame = self.source.read_frame<EOL>while not queue:<EOL><INDENT>try:<EOL><INDENT>frame_type, channel, payload = read_frame()<EOL><DEDENT>except Exception as exc:<EOL><INDENT>put(exc)<EOL>break<EOL><DEDENT>self.bytes_recv += <NUM_LIT:1><EOL>if frame_type not in (self.expected_types[channel], <NUM_LIT:8>):<EOL><INDENT>put((<EOL>channel,<EOL>UnexpectedFrame(<EOL>'<STR_LIT>'.format(<EOL>frame_type, self.expected_types[channel]))))<EOL><DEDENT>elif frame_type == <NUM_LIT:1>:<EOL><INDENT>self._process_method_frame(channel, payload)<EOL><DEDENT>elif frame_type == <NUM_LIT:2>:<EOL><INDENT>self._process_content_header(channel, payload)<EOL><DEDENT>elif frame_type == <NUM_LIT:3>:<EOL><INDENT>self._process_content_body(channel, payload)<EOL><DEDENT>elif frame_type == <NUM_LIT:8>:<EOL><INDENT>self._process_heartbeat(channel, payload)<EOL><DEDENT><DEDENT>
Read the next method from the source, once one complete method has
        been assembled it is placed in the internal queue.