code: 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
docs: Insert an OptionGroup at a given position.