code: def create(self, dotdata, prog="dot", format="xdot"):
          import os, tempfile
          from dot2tex.dotparsing import find_graphviz
          progs = find_graphviz()
          if progs is None:
              logger.warning("GraphViz executables not found.")
              return None
          if not progs.has_key(prog):
              logger.warning('Invalid program [%s]. Available programs are: %s' % \
                             (prog, progs.keys()))
              return None
          tmp_fd, tmp_name = tempfile.mkstemp()
          os.close(tmp_fd)
          dot_fd = file(tmp_name, "w+b")
          dot_fd.write(dotdata)
          dot_fd.close()
          tmp_dir = os.path.dirname(tmp_name)
          p = subprocess.Popen((progs[prog], '-T'+format, tmp_name),
              cwd=tmp_dir, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
          stderr = p.stderr
          stdout = p.stdout
          stdout_output = list()
          while True:
              data = stdout.read()
              if not data:
                  break
              stdout_output.append(data)
          stdout.close()
          if stdout_output:
              stdout_output = ''.join(stdout_output)
          if not stderr.closed:
              stderr_output = list()
              while True:
                  data = stderr.read()
                  if not data:
                      break
                  stderr_output.append(data)
              stderr.close()
              if stderr_output:
                  stderr_output = ''.join(stderr_output)
          status = p.wait()
          if status != 0 :
              logger.error("Program [%s] terminated with status: %d. stderr " \
                  "follows: %s" % ( prog, status, stderr_output ) )
          elif stderr_output:
              logger.error( "%s", stderr_output )
          os.unlink(tmp_name)
          return stdout_output