Przepisz podany kod, lecz dodaj komentarze.
def next_generator(self):
for item in self.data:
self.save_prev_item()

match_instruction = re.search(self.pattern_instruction, item['instruction'])
match_input = re.search(self.pattern_input, item['input'])
match_output = re.search(self.pattern_output, item['output'])
jeśli match_instruction lub match_input lub match_output:
new_instruction = item['instruction']
new_input = item['input']
old_output = item['output']
modified_output = self.modify_output(match_output, item)

self.fill_values(new_instruction, new_input, old_output, modified_output)
self.prev_item = element
yield self.instruction, self.input, self.old_output, self.modified_output

self.save_prev_item()
self.fill_values(instruction='Osiągnięto koniec dopasowań.')

while True:
yield self.instruction, self.input, self.old_output, self.