Python code for serial port communication