Curiously, while not related at all, Liffylights has the same bug. It is on this line and you have to change it into
size = pack("<H", len(contents) + 2)
if I recall correctly. Liffylights is not maintained so this will not be fixed (not by me, at least).
Edit: if someone wonders, I mixed up two bugs. This Liffylights bug is similar to issue #8284, affecting LIFX Generation 2 bulbs with firmware 1.22.