def extract_attributes(element, prefix_key_char='<STR_LIT:@>', dict_constructor=dict):
result = dict_constructor()<EOL>if element.properties:<EOL><INDENT>for prop in element.properties:<EOL><INDENT>if not prop:<EOL><INDENT>break<EOL><DEDENT>if prop.type == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>result["<STR_LIT>" % (prefix_key_char, prop.ns().name, prop.name)] = prop.content<EOL><DEDENT>except:<EOL><INDENT>result["<STR_LIT>" % (prefix_key_char, prop.name)] = prop.content<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return result<EOL>
Given an XML node, extract a dictionary of attribute key-value pairs.
Optional arguments:

- prefix_key_char: if a character is given, the attributes keys
  in the resulting dictionary are prefixed with that character.

- dict_constructor: the class used to create the resulting dictionary.
  Default is 'dict', but in DINGO, also DingoObjDict may be used.