def __init__(self,*classes,**options):
         "Generates the MRO graph of a set of given classes."
         if not classes: raise "Missing class argument!"
         filename=options.get('filename',"MRO_of_%s.ps" % classes[0].__name__)
         self.labels=options.get('labels',2)
         caption=options.get('caption',False)
         setup=options.get('setup','')
         name,dotformat=os.path.splitext(filename)
         format=dotformat[1:] 
         fontopt="fontname="+if_(format=='ps',PSFONT,PNGFONT)
         nodeopt=' node [%s];\n' % fontopt
         edgeopt=' edge [%s];\n' % fontopt
         viewer=if_(format=='ps',PSVIEWER,PNGVIEWER)
         self.textrepr='\n'.join([MRO(cls) for cls in classes])
         caption=if_(caption,
                    'caption [shape=box,label="%s\n",fontsize=9];'
                    % self.textrepr).replace('\n','\\l')
         setupcode=nodeopt+edgeopt+caption+'\n'+setup+'\n'
         codeiter=itertools.chain(*[self.genMROcode(cls) for cls in classes])
         self.dotcode='digraph %s{\n%s%s}' % (
             name,setupcode,'\n'.join(codeiter))
         os.system("echo '%s' | dot -T%s > %s; %s %s&" %
               (self.dotcode,format,filename,viewer,filename))
Generates the MRO graph of a set of given classes.
recipes/Python/213898_Drawing_inheritance_diagrams/recipe-213898.py