code: def next_group_id(self) -> int:
          
          ids: typing.Set[int] = set()
          for group in chain(self._blue_coa.groups, self._red_coa.groups):  # type: ignore
  
              id_ = group.group_id
              if id_ in ids:
                  raise IndexError(group.group_name)
              ids.add(id_)
          return max(ids) + 1
docs: Returns: next free GroupId