def _generate_layout(self):
     """Generate the bracket layout for display."""
     space = (None, None)
     first = 2 ** (self.phases - 1)
     line_count = first * 5 - 1
     layout = init_nested_list(line_count)
     first_team = True
     match_gen = self._match_for_layout
     for phase in range(self.phases):
         first = 2 ** (self.phases - 1)
         match_num = 0
         round = phase * 2
         div = 2 * 2 ** phase
         for i in range(first):
             layout[i].append(space)
         for i in range(first, line_count):
             (conf, layout_entry) = match_gen(((i - first) % div == 0),
                                              round, match_num, first_team)
             layout[i].append(layout_entry)
             (match_num, first_team) = conf
         # Major round
         match_num = 0
         first -= 2 ** phase
         round += 1
         for i in range(first):
             layout[i].append(space)
         for i in range(first, line_count):
             try:
                 (conf, layout_entry) = match_gen(((i - first) % div == 0),
                                                  round, match_num, first_team)
                 layout[i].append(layout_entry)
                 (match_num, first_team) = conf
             except IndexError:
                 layout[i].append(space)
     return layout
 def _generate_layout(self):
     """Generate the bracket layout for display."""
     line_count = self.team_count * 2 - 1
     layout = init_nested_list(line_count)
     first_team = True
     match_gen = self._match_for_layout
     for round in range(self.round_count):
         match_num = 0
         div = 2 * 2 ** round
         mod = div // 2 - 1
         for i in range(line_count):
             (conf, layout_entry) = match_gen((i % div == mod),
                                              round, match_num,
                                              first_team)
             layout[i].append(layout_entry)
             (match_num, first_team) = conf
     return layout