def parse_attributes(self, attrstring):
if attrstring in [None, '<STR_LIT>', '<STR_LIT:.>']:<EOL><INDENT>return dict()<EOL><DEDENT>attributes = dict()<EOL>keyvaluepairs = attrstring.split('<STR_LIT:;>')<EOL>for kvp in keyvaluepairs:<EOL><INDENT>if kvp == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>key, value = kvp.split('<STR_LIT:=>')<EOL>if key == '<STR_LIT>':<EOL><INDENT>assert '<STR_LIT:U+002C>' not in value<EOL>attributes[key] = value<EOL>continue<EOL><DEDENT>values = value.split('<STR_LIT:U+002C>')<EOL>valdict = dict((val, True) for val in values)<EOL>attributes[key] = valdict<EOL><DEDENT>return attributes<EOL>
Parse an attribute string.

Given a string with semicolon-separated key-value pairs, populate a
dictionary with the given attributes.