function createSubscriptionObject(_topic, _options, _ref, _brokerId) {
            /** @type {Subscription} */
            const subscription = {};
            const ref = _ref || 0;
            let options
            let qos = 1 // default to QoS 1 (AWS and several other brokers don't support QoS 2)

            // if options is an object, then clone it
            if (typeof _options == "object") {
                options = RED.util.cloneMessage(_options || {})
                qos = _options.qos;
            } else if (typeof _options == "number") {
                qos = _options;
            }
            options = options || {};

            // sanitise qos
            if (typeof qos === "number" && qos >= 0 && qos <= 2) {
                options.qos = qos;
            }

            subscription.topic = _topic;
            subscription.qos = qos;
            subscription.options = RED.util.cloneMessage(options);
            subscription.ref = ref;
            subscription.brokerId = _brokerId;
            return subscription;
        }
Create a subscription object
@param {String} _topic - topic to subscribe to
@param {Object} _options - options object
@param {String} _ref - reference to the node that created the subscription
@returns {Subscription}