def hc_consume(c) -> Union[Health, None]: """Get a health record from the kafka consumer if there is a new one.""" msg = c.poll(1.0) if msg is None: return if msg.error(): print("Consumer error: {}".format(msg.error())) return health_record = Health.from_json(msg.value().decode("utf-8")) c.commit() print(f"Received health record {health_record}") return health_record