I would not expect such a plugin to exist, or worth writing. We have just covered one very special use case: categorizing sorted four-element arrays according to their third element, and formatting them as plain text. You may have noted that choroba's output is different from mine, but we don't know whether it matters.
I myself would wrap the formatting into my template processing, either as a MACRO, where the transformation is done in TT language, or as a FILTER, where the transformation is done in a Perl module. Macros and filters can be predefined to the TT object, so the data template would just read [% categorize(data) %] with a macro, or [% data | categorize %] if you implement the formatting as a filter.