Python code to help with PLC ladder logic programming