class BaseRouter: def post_message(self, namespace: bytes, topic: bytes, kind: bytes, body: bytes) -> None: raise NotImplementedError class StdOutRouter(BaseRouter): def post_message(self, namespace: bytes, topic: bytes, kind: bytes, body: bytes) -> None: print(f'ns={namespace.decode()},t={topic.decode()},k={kind.decode()} {body.decode()}')