code: function configSaveFunc(sensor) {
      return function(callback) {
          if (this.isModified()) {
              // if this is an out of range config and grace period is one of the
              // properties changed, then start with saving that, which
              // unfortunately is a separate (and undocumented) API call.
              let setGrace;
              if (this.isModified('gracePeriod')) {
                  let ecb = callback ?
                      (e) => { if (e) callback(e); } : undefined;
                  setGrace = setOutOfRangeGracePeriod(sensor, ecb);
              } else {
                  setGrace = Promise.resolve(sensor);
              }
              // then save the (possibly rest of) monitoring config
              let req = setGrace.then((s) => {
                  let ecb = callback ?
                      (e) => { if (e) callback(e); } : undefined;
                  return setMonitoringConfig(s, ecb);
              });
              // finally convert from sensor to config to simplify chaining
              return req.then((s) => {
                  let mconfig = s.monitoringConfig().resetModified();
                  s.emit('config', s, mconfig, 'save');
                  if (callback) callback(null, { object: mconfig });
                  return mconfig;
              });
          }
          return Promise.resolve(this);
      };
  }
docs: /* eslint-disable no-invalid-this 
  Creates a function to be used as {@link MonitoringConfig#save}.
  
  @param {WirelessTagSensor} sensor - the sensor object to which the
  monitoring configuration object is associated that the returned
  function should be capable of saving.
  @returns {function}
  @private