def decode_body(cls, header, f):
        """Generates a `MqttPubrel` packet given a
        `MqttFixedHeader`.  This method asserts that header.packet_type
        is `pubrel`.

        Parameters
        ----------
        header: MqttFixedHeader
        f: file
            Object with a read method.

        Raises
        ------
        DecodeError
            When there are extra bytes at the end of the packet.

        Returns
        -------
        int
            Number of bytes consumed from ``f``.
        MqttPubrel
            Object extracted from ``f``.
        """
        assert header.packet_type == MqttControlPacketType.pubrel

        decoder = mqtt_io.FileDecoder(mqtt_io.LimitReader(f, header.remaining_len))
        packet_id, = decoder.unpack(mqtt_io.FIELD_U16)

        if header.remaining_len != decoder.num_bytes_consumed:
            raise DecodeError('Extra bytes at end of packet.')

        return decoder.num_bytes_consumed, MqttPubrel(packet_id)
def decode_body ( cls , header , f ) : assert header . packet_type == MqttControlPacketType . pubrel decoder = mqtt_io . FileDecoder ( mqtt_io . LimitReader ( f , header . remaining_len ) ) packet_id , = decoder . unpack ( mqtt_io . FIELD_U16 ) if header . remaining_len != decoder . num_bytes_consumed : raise DecodeError ( 'Extra bytes at end of packet.' ) return decoder . num_bytes_consumed , MqttPubrel ( packet_id )
Generates a `MqttPubrel` packet given a
        `MqttFixedHeader`.  This method asserts that header.packet_type
        is `pubrel`.

        Parameters
        ----------
        header: MqttFixedHeader
        f: file
            Object with a read method.

        Raises
        ------
        DecodeError
            When there are extra bytes at the end of the packet.

        Returns
        -------
        int
            Number of bytes consumed from ``f``.
        MqttPubrel
            Object extracted from ``f``.