code: function getCharacteristicFormatsKey(format) {
    // coerce 'int32' to 'int'
    if (format == 'int32') format = 'int';
  
    // look up the key in our known-formats dict
    for (var key in Characteristic.Formats)
      if (Characteristic.Formats[key] == format)
        return key;
  
    throw new Error("Unknown characteristic format '" + format + "'");
  }
docs: Useful functions