def create(self, prog=None, format=None):
prog = self.program if prog is None else prog<EOL>format = self.format if format is None else format<EOL>tmp_fd, tmp_name = tempfile.mkstemp()<EOL>os.close( tmp_fd )<EOL>dot_fd = file( tmp_name, "<STR_LIT>" )<EOL>self.save_dot( dot_fd )<EOL>dot_fd.close()<EOL>tmp_dir = os.path.dirname( tmp_name )<EOL>p = subprocess.Popen(<EOL>( self.programs[ prog ], '<STR_LIT>'+format, tmp_name ),<EOL>cwd=tmp_dir,<EOL>stderr=subprocess.PIPE, stdout=subprocess.PIPE)<EOL>stderr = p.stderr<EOL>stdout = p.stdout<EOL>stdout_output = list()<EOL>while True:<EOL><INDENT>data = stdout.read()<EOL>if not data:<EOL><INDENT>break<EOL><DEDENT>stdout_output.append(data)<EOL><DEDENT>stdout.close()<EOL>if stdout_output:<EOL><INDENT>stdout_output = '<STR_LIT>'.join(stdout_output)<EOL><DEDENT>if not stderr.closed:<EOL><INDENT>stderr_output = list()<EOL>while True:<EOL><INDENT>data = stderr.read()<EOL>if not data:<EOL><INDENT>break<EOL><DEDENT>stderr_output.append(data)<EOL><DEDENT>stderr.close()<EOL>if stderr_output:<EOL><INDENT>stderr_output = '<STR_LIT>'.join(stderr_output)<EOL><DEDENT><DEDENT>status = p.wait()<EOL>if status != <NUM_LIT:0> :<EOL><INDENT>logger.error("<STR_LIT>""<STR_LIT>" % ( status, stderr_output ) )<EOL><DEDENT>elif stderr_output:<EOL><INDENT>logger.error( "<STR_LIT:%s>", stderr_output )<EOL><DEDENT>os.unlink(tmp_name)<EOL>return stdout_output<EOL>
Creates and returns a representation of the graph using the
            Graphviz layout program given by 'prog', according to the given
            format.

            Writes the graph to a temporary dot file and processes it with
            the program given by 'prog' (which defaults to 'dot'), reading
            the output and returning it as a string if the operation is
            successful. On failure None is returned.