<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse(self, generator):
 """Parse an iterable source of strings into a generator"""

        gen = iter(generator)
        for line in gen:
            block = {}
            for rule in self.rules:
                if rule[0](line):
                    block = rule[1](line, gen)
                    break
            yield block