code: func (cli *Client) validatePacketID(packets map[uint16]packet.Packet, id uint16, ptype byte) error {
  	// Extract the Packet.
  	p, exist := packets[id]
  
  	if !exist {
  		// Return an error if there is no Packet which has the Packet Identifier
  		// specified by the parameter.
  		return packet.ErrInvalidPacketID
  	}
  
  	// Extract the MQTT Control Packet type of the Packet.
  	t, err := p.Type()
  	if err != nil {
  		return err
  	}
  
  	if t != ptype {
  		// Return an error if the Packet's MQTT Control Packet type does not
  		// equal to one specified by the parameter.
  		return packet.ErrInvalidPacketID
  	}
  
  	return nil
  }
docs: // validateSendingPacketID checks if the Packet which has
  // the Packet Identifier and the MQTT Control Packet type
  // specified by the parameters exists in the Session's
  // sendingPackets.