def get_anon_name(rec):<EOL>
if "<STR_LIT:name>" in rec:<EOL><INDENT>return rec["<STR_LIT:name>"]<EOL><DEDENT>anon_name = "<STR_LIT>"<EOL>if rec['<STR_LIT:type>'] in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>for sym in rec["<STR_LIT>"]:<EOL><INDENT>anon_name += sym<EOL><DEDENT>return "<STR_LIT>"+hashlib.sha1(anon_name.encode("<STR_LIT>")).hexdigest()<EOL><DEDENT>if rec['<STR_LIT:type>'] in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>for field in rec["<STR_LIT>"]:<EOL><INDENT>anon_name += field["<STR_LIT:name>"]<EOL><DEDENT>return "<STR_LIT>"+hashlib.sha1(anon_name.encode("<STR_LIT>")).hexdigest()<EOL><DEDENT>if rec['<STR_LIT:type>'] in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>raise validate.ValidationException("<STR_LIT>" % rec['<STR_LIT:type>'])<EOL>
Calculate a reproducible name for anonymous types.