def main_loop(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)<EOL>port = int(getattr(self, '<STR_LIT:port>', <NUM_LIT>))<EOL>sock.bind(('<STR_LIT:127.0.0.1>', port))<EOL>while True:<EOL><INDENT>data, addr = sock.recvfrom(<NUM_LIT>)<EOL>color = data.decode().strip()<EOL>self.color = self.colors.get(color, color)<EOL><DEDENT>
Mainloop blocks so we thread it.