<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_branch_data(self, file):
 """ Writes branch data to an Excel spreadsheet. """

        branch_sheet = self.book.add_sheet("Branches")

        for i, branch in enumerate(self.case.branches):
            for j, attr in enumerate(BRANCH_ATTRS):
                branch_sheet.write(i, j, getattr(branch, attr))