Raspberry Pi Motor Encoder Python