def get_attribute(self, attrkey, as_string=False, as_list=False):
assert not as_string or not as_list<EOL>if attrkey not in self._attrs:<EOL><INDENT>return None<EOL><DEDENT>if attrkey == '<STR_LIT>':<EOL><INDENT>return self._attrs[attrkey]<EOL><DEDENT>attrvalues = list(self._attrs[attrkey])<EOL>attrvalues.sort()<EOL>if len(attrvalues) == <NUM_LIT:1> and not as_list:<EOL><INDENT>return attrvalues[<NUM_LIT:0>]<EOL><DEDENT>elif as_string:<EOL><INDENT>return '<STR_LIT:U+002C>'.join(attrvalues)<EOL><DEDENT>return attrvalues<EOL>
Get the value of an attribute.

By default, returns a string for ID and attributes with a single value,
and a list of strings for attributes with multiple values. The
`as_string` and `as_list` options can be used to force the function to
return values as a string (comma-separated in case of multiple values)
or a list.