def METHOD_NAME(self) -> None:
    while True:
        ev = self._events.recv()
        if isinstance(ev, Shutdown):
            break
        elif isinstance(ev, PredictionInput):
            self._predict(ev.payload)
        else:
            print(f"Got unexpected event: {ev}", file=sys.stderr)