def print_inheritance(doc, stream):<EOL>
stream.write("<STR_LIT>")<EOL>for entry in doc:<EOL><INDENT>if entry["<STR_LIT:type>"] == "<STR_LIT>":<EOL><INDENT>label = name = shortname(entry["<STR_LIT:name>"])<EOL>fields = entry.get("<STR_LIT>", [])<EOL>if fields:<EOL><INDENT>label += "<STR_LIT>" % (<EOL>"<STR_LIT>".join(shortname(field["<STR_LIT:name>"])<EOL>for field in fields))<EOL><DEDENT>shape = "<STR_LIT>" if entry.get("<STR_LIT>") else "<STR_LIT>"<EOL>stream.write("<STR_LIT>"<EOL>% (name, shape, label))<EOL>if "<STR_LIT>" in entry:<EOL><INDENT>for target in aslist(entry["<STR_LIT>"]):<EOL><INDENT>stream.write("<STR_LIT>"<EOL>% (shortname(target), name))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>stream.write("<STR_LIT>")<EOL>
Write a Grapviz inheritance graph for the supplied document.