def METHOD_NAME(bucket: MetricsBucket) -> Message[KafkaPayload]:
    nonlocal generate_kafka_message_counter
    encoded = json.dumps(bucket).encode()
    payload = KafkaPayload(key=None, value=encoded, headers=[])
    message = Message(
        BrokerValue(
            payload,
            Partition(topic, index=0),
            generate_kafka_message_counter,
            datetime.now(timezone.utc),
        )
    )
    generate_kafka_message_counter += 1
    return message