def METHOD_NAME(
    message: Mapping[str, Any],
    metadata: KafkaMessageMetadata,
    retention_days: int,
    received: datetime,
) -> Mapping[str, Any]:
    transaction = message["transactions"][0]
    device = message["device"]
    os = message["os"]
    return {
        "android_api_level": message.get("android_api_level"),
        "architecture": device.get("architecture", "unknown"),
        "device_classification": device.get("classification", ""),
        "device_locale": device.get("locale", ""),
        "device_manufacturer": device.get("manufacturer", ""),
        "device_model": device.get("model", ""),
        "device_os_build_number": os.get("build_number"),
        "device_os_name": os.get("name", ""),
        "device_os_version": os.get("version", ""),
        "duration_ns": int(
            transaction["relative_end_ns"] - transaction["relative_start_ns"]
        ),
        "environment": message.get("environment"),
        "offset": metadata.offset,
        "organization_id": message["organization_id"],
        "partition": metadata.partition,
        "platform": message["platform"],
        "profile_id": str(UUID(message["event_id"])),
        "project_id": message["project_id"],
        "received": received,
        "retention_days": retention_days,
        "trace_id": str(UUID(transaction["trace_id"])),
        "transaction_id": str(UUID(transaction["id"])),
        "transaction_name": transaction["name"],
        "version_code": message.get("version_code", ""),
        "version_name": message["release"],
    }