char *
ofl_structs_bucket_to_string(struct ofl_bucket *b, struct ofl_exp *exp) {
        char *str;
    size_t str_size;
    FILE *stream = open_memstream(&str, &str_size);
    ofl_structs_bucket_print(stream, b, exp);
    fclose(stream);
    return str;
}
void
ofl_structs_group_desc_stats_print(FILE *stream, struct ofl_group_desc_stats *s, struct ofl_exp *exp) {
    size_t i;

    fprintf(stream, "{type=\"");
    ofl_group_type_print(stream, s->type);
    fprintf(stream, "\", group=\"");
    ofl_group_print(stream, s->group_id);
    fprintf(stream, "\", buckets=[");

    for (i=0; i<s->buckets_num; i++) {
        ofl_structs_bucket_print(stream, s->buckets[i], exp);
        if (i < s->buckets_num - 1) { fprintf(stream, ", "); };
    }

    fprintf(stream, "]}");
}
static void
ofl_msg_print_group_mod(struct ofl_msg_group_mod *msg, FILE *stream, struct ofl_exp *exp) {
    size_t i;

    fprintf(stream,"{group=\"");
    ofl_group_print(stream, msg->group_id);
    fprintf(stream,"\", cmd=\"");
    ofl_group_mod_command_print(stream, msg->command);
    fprintf(stream, "\", type=\"");
    ofl_group_type_print(stream, msg->type);
    fprintf(stream,"\", buckets=[");

    for (i=0; i<msg->buckets_num; i++) {
        ofl_structs_bucket_print(stream, msg->buckets[i], exp);

        if (i < msg->buckets_num - 1) { fprintf(stream, ", "); }
    }

    fprintf(stream, "]}");
}