code: def write_generator_data(self, file, padding="    "):
          
          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))
docs: Write generator data in Graphviz DOT language.