code: def write(self, path, prog=None, format='raw'):
          
  
          if prog is None:
              prog = self.prog
          
          dot_fd = file(path, "w+b")
          if format == 'raw':
              data = self.to_string()
              if isinstance(data, basestring):
                  if not isinstance(data, unicode):
                      try:
                          data = unicode(data, 'utf-8')
                      except:
                          pass
                          
              try:
                  data = data.encode('utf-8')
              except:
                  pass
              dot_fd.write(data)
          else:
              dot_fd.write(self.create(prog, format))
          dot_fd.close()
  
          return True
docs: Writes a graph to a file.
  
          Given a filename 'path' it will open/create and truncate
          such file and write on it a representation of the graph
          defined by the dot object and in the format specified by
          'format'.
          The format 'raw' is used to dump the string representation
          of the Dot object, without further processing.
          The output can be processed by any of graphviz tools, defined
          in 'prog', which defaults to 'dot'
          Returns True or False according to the success of the write
          operation.
          
          There's also the preferred possibility of using:
          
              write_'format'(path, prog='program')
              
          which are automatically defined for all the supported formats.
          [write_ps(), write_gif(), write_dia(), ...]