Writes branch data to a ReST table.

def write_branch_data(self, file):
        """ Writes branch data to a ReST table.
        """
        report = CaseReport(self.case)
        branches = self.case.branches

        col_width   = 8
        col_width_2 = col_width*2+1
        col1_width  = 7

        sep = ("=" * 7 + " ") * 3 + ("=" * col_width + " ") * 6 + "\n"

        file.write(sep)
        # Line one of column headers
        file.write("Name".center(col1_width) + " ")
        file.write("From".center(col1_width) + " ")
        file.write("To".center(col1_width) + " ")
        file.write("From Bus Inj".center(col_width_2) + " ")
        file.write("To Bus Inj".center(col_width_2) + " ")
        file.write("Loss (I^2 * Z)".center(col_width_2) + " ")
        file.write("\n")

        file.write(("-"*col1_width +" ")*3)
        file.write(("-"*col_width_2 +" ")*3 + "\n")

        # Line two of column header
        file.write("..".ljust(col1_width) + " ")
        file.write("Bus".center(col1_width) + " ")
        file.write("Bus".center(col1_width) + " ")
        file.write("P (MW)".center(col_width) + " ")
        file.write("Q (MVAr)".center(col_width) + " ")
        file.write("P (MW)".center(col_width) + " ")
        file.write("Q (MVAr)".center(col_width) + " ")
        file.write("P (MW)".center(col_width) + " ")
        file.write("Q (MVAr)".center(col_width) + " ")
        file.write("\n")

        file.write(sep)
        # Branch rows
        loss = report._loss()
        for each in branches:
            file.write(each.name[:col1_width].ljust(col1_width) + " ")
            file.write(each.from_bus.name[:col1_width].ljust(col1_width)+" ")
            file.write(each.to_bus.name[:col1_width].ljust(col1_width)+" ")
            file.write("%8.2f " % each.p_from)
            file.write("%8.2f " % each.q_from)
            file.write("%8.2f " % each.p_to)
            file.write("%8.2f " % each.q_to)
            file.write("%8.2f " % loss.real[each._i])
            file.write("%8.2f " % loss.imag[each._i])
            file.write("\n")

        # Totals
#        file.write("..".ljust(col1_width) + " ")
#        file.write(("..".ljust(col_width) + " ")*2)
#        file.write(("_"*col_width + " ")*4 + "\n")
        file.write(("..".ljust(col1_width) + " ")*3)
        file.write(("..".ljust(col_width) + " ")*3)
        file.write("*Total:*".rjust(col_width) + " ")
        pl, ql = report.losses
        file.write("%8.2f " % pl)
        file.write("%8.2f " % ql)
        file.write("\n")

        file.write(sep)

        del report