enum property drop down with labled columns

Examples in the UI are the Math shader nodes Operator drop down (Also similar, but not an enum is the Add Modifier drop down). They have columns with headings and the items grouped under them.

How is this effect achieved? I can't see what the Math node does, but the UI code for the Modifier drop down doesn't have anything special it just uses 'operator_menu_enum' UILayout.

Is it possible to achieve the same thing in an add-on?

(It seems like it might use the menu system to draw the layout and I thought 'prop_with_menu' function might be on the right track. But calling that in the draw method crashes blender, so I don't know if and how it can be used at all.)

Loosely following the example of the "Math" node in the C code (rna_nodetree.c, line 177— Warning: File is huge.), it turns out that the items in an EnumProperty are sorted into columns by the 1th index (name) of the most recently preceding item that has neither an identifier nor a description:

bpy.types.Scene.TestProp = bpy.props.EnumProperty(
items = (
("", "ColumnA", ""),
("ColA1", "ColA1", "Desc."),
("ColA2", "ColA2", "Desc."),
("ColA3", "ColA3", "Desc."),
("", "ColumnB", ""),
("ColB1", "ColB1", "Desc."),
("ColB2", "ColB2", "Desc.")
)
)


I don't believe this behaviour is currently documented anywhere.

Vaguely relevant (but better documented):

None can also be used to insert separators in the middle of each column.