<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_generator_data(self, file):
 """ Write generator data to file. """

        generator_sheet = self.book.add_sheet("Generators")

        for j, generator in enumerate(self.case.generators):
            i = generator.bus._i
            for k, attr in enumerate(GENERATOR_ATTRS):
                generator_sheet.write(j, 0, i)