code: def next_unit_id(self) -> int:
          
          ids: typing.Set[int] = set()
          for unit in chain(self._blue_coa.units, self._red_coa.units):  # type: ignore
  
              id_ = unit.unit_id
              if id_ in ids:
                  raise IndexError(unit.unit_name)
              ids.add(id_)
          return max(ids) + 1
docs: Returns: next free Unit ID