def genMROcode(self,cls):
         "Generates the dot code for the MRO of a given class"
         for mroindex,c in enumerate(cls.__mro__):
             name=c.__name__
             manyparents=len(c.__bases__) > 1
             if c.__bases__:
                 yield ''.join([
                     ' edge [style=solid]; %s -> %s %s;\n' % (
                     b.__name__,name,if_(manyparents and self.labels==2,
                                         '[label="%s"]' % (i+1)))
                     for i,b in enumerate(c.__bases__)])
             if manyparents:
                 yield " {rank=same; %s}\n" % ''.join([
                     '"%s"; ' % b.__name__ for b in c.__bases__])
             number=if_(self.labels,"%s-" % mroindex)
             label='label="%s"' % (number+name)
             option=if_(issubclass(cls,type), # if cls is a metaclass
                        '[%s]' % label, 
                        '[shape=box,%s]' % label)
             yield(' %s %s;\n' % (name,option))
             if type(c) is not type: # c has a custom metaclass
                 metaname=type(c).__name__
                 yield ' edge [style=dashed]; %s -> %s;' % (metaname,name)
Generates the dot code for the MRO of a given class
recipes/Python/213898_Drawing_inheritance_diagrams/recipe-213898.py