Python serial protocol