How can the active bone group be set from a script?
Example:

import bpy

obj = bpy.data.objects['Armature']
bone_groups = obj.pose.bone_groups

bone_groups.active = bone_groups[string_key]
#or
bone_groups.active_index = new_index