def write_method(self, method):
        """Write method to connection, destined for the channel as set in `method.channel_id`

        This implementation uses a queue internally to prepare all frames before writing in order
        to detect issues.

        This method is thread safe only if the `channel_id` parameter is unique across concurrent
        invocations. The AMQP protocol allows interleaving frames destined for different channels,
        but not within the same channel. This means no more than one thread may safely operate on
        any given channel.

        :param method: method to write
        :type method: amqpy.proto.Method
        """
        transport = self.transport
        log.debug('{:7} channel: {} {} {}'
                  .format('Write:', method.channel_id,
                          method.method_type, METHOD_NAME_MAP[method.method_type]))
        frames = Queue()

        # construct a method frame
        frames.put(method.dump_method_frame())

        if method.content:
            # construct a header frame
            frames.put(method.dump_header_frame())

            # construct one or more body frames, which contain the body of the `Message`
            chunk_size = self.frame_max - 8
            for frame in method.dump_body_frame(chunk_size):
                frames.put(frame)

        while not frames.empty():
            transport.write_frame(frames.get())

        self.methods_sent += 1
dataset/ETHPy150Open veegee/amqpy/amqpy/method_io.py/MethodWriter.write_method/original