def extract_attributes(html_element):
 parser = HTMLAttributeParser()
 parser.feed(html_element)
 parser.close()
 return parser.attrs

def extract_attributes ( html_element ) : parser = HTMLAttributeParser ( ) parser . feed ( html_element ) parser . close ( ) return parser . attrs
given a string for an html element such as <el a="foo" b="bar" c="&98;az" d=boz empty= noval entity="&amp;" sq=" dq="" decode and return a dictionary of attributes .