function cleanupFeatures(features, zwaveJsDevice) {
  let localFeatures = features;
  // ------------------------------
  // Multilevel Switch special case
  // ------------------------------
  // Some Multilevel Switch device have an explicit Binary Switch
  // exposed some others not (Qubino vs Fibaro for example). As for
  // devices that do not expose any Binary Switch value, we manage
  // a virtual one through the Multilevel Switch. In order to improve
  // the user experience, we so cleanup any explicit Binary Switch
  // so the user doesn't see too many options when managing their device
  // (we keep the virtual one because it is correctly synchronized with
  // others features - state & position - and keeps code simpler)
  if (localFeatures.some((f) => f.command_class === COMMANDCLASS.MULTILEVEL_SWITCH)) {
    localFeatures = localFeatures.filter((f) => f.command_class !== COMMANDCLASS.BINARY_SWITCH);
  }

  // ----------------------------------------------
  // Fibaro Motion Sensor special case (FGMS-001)
  // ----------------------------------------------
  // Some Fibaro Motion Sensor have an explicit Binary Sensor General Purpose some others don't.
  // We so need to deal with those having the General Purpose and not rely on the "Any" feature.
  // On the other hand, those not exposing the General Purpose are correctly handled by the "Any" feature.
  // The alarm sensor seems not usefull, so we remove it.
  if (zwaveJsDevice.deviceId === PRODUCTID.FIBARO_FGMS001) {
    // Remove the Alarm Sensor
    localFeatures = localFeatures.filter((f) => f.command_class !== COMMANDCLASS.ALARM_SENSOR);

    // Remove the Any Binary Sensor if the General Purpose is present
    if (
      localFeatures.some(
        (f) => f.command_class === COMMANDCLASS.BINARY_SENSOR && cleanNames(f.property_name) === 'general_purpose',
      )
    ) {
      localFeatures = localFeatures.filter(
        (f) => !(f.command_class === COMMANDCLASS.BINARY_SENSOR && cleanNames(f.property_name) === 'any'),
      );
    }
  }

  // Add any other special cleanup necessary... Please, provide an explanation

  return localFeatures;
}
@description Cleanup features.
For example: remove a Binary Switch sent by a device on a
Multilevel Switch (we do manage a virtual one on Gladys).
@param {Array} features - Detected features on the node.
@param {object} zwaveJsDevice - The ZwaveJs device.
@returns {Array} The cleaned up features.
@example cleanupFeatures(features)