code: def build_command_groups(self, block):
          
          text = block['text']
  
          commands = sorted(self.build_commands(block))
          grouped = groupby(commands, Command.key)
          listed = list(groupby(commands, Command.key))
          sliced = []
  
          i = 0
          for start_index, commands in grouped:
              if i < len(listed) - 1:
                  stop_index = listed[i + 1][0]
                  sliced.append((text[start_index:stop_index], list(commands)))
              else:
                  sliced.append((text[start_index:start_index], list(commands)))
              i += 1
  
          return sliced
docs: Creates block modification commands, grouped by start index,
          with the text to apply them on.