MDL-36541 modify get_groupings to optionally return associated groups