list_by_groups fetch function
There is also a list_by_groups fetch function.
Definition:
fetch( 'class', 'list_by_groups', hash( 'group_filter', false|array ,
[ 'group_filter_type', 'include'|exclude ] ) )
group_filter should be array of class group id's
You can use ini settings from [ClassGroupIDs] in content.ini to get id's.
For real world example, see design/admin(2)/templates/contentstructuremenu/content_structure_menu_dynamic.tpl
It was probably added in 3.10, as dynamic csm was added then and this is only place it is currently used.