Python code I used in my Raspberry Pi project for a course