code: def main_loop(self):
          
          sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
          port = int(getattr(self, 'port', 1738))
          sock.bind(('127.0.0.1', port))
          while True:
              data, addr = sock.recvfrom(512)
              color = data.decode().strip()
              self.color = self.colors.get(color, color)
docs: Mainloop blocks so we thread it.