Port library from Raspberry Pi to pyMCU.