'Insert an OptionGroup at a given position.'

def insert_option_group(self, idx, *args, **kwargs):

    group = self.add_option_group(*args, **kwargs)
    self.option_groups.pop()
    self.option_groups.insert(idx, group)
    return group
