<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, padding=" "):
 """ Write generator data in Graphviz DOT language. """

        attrs = ['%s="%s"' % (k, v) for k, v in self.gen_attr.iteritems()]
        attr_str = ", ".join(attrs)

        edge_attrs = ['%s="%s"' % (k,v) for k,v in {}.iteritems()]
        edge_attr_str = ", ".join(edge_attrs)

        for g in self.case.generators:
            # Generator node.
            file.write("%s%s [%s];\n" % (padding, g.name, attr_str))

            # Edge connecting generator and bus.
            file.write("%s%s -> %s [%s];\n" % \
                       (padding, g.name, g.bus.name, edge_attr_str))