def get_element_by_attribute(attribute, value, html):
 m = re.search((u'(?xs)\n        <([a-zA-Z0-9:._-]+)\n         (?:\\s+[a-zA-Z0-9:._-]+(?:=[a-zA-Z0-9:._-]+|="[^"]+"|=\'[^\']+\'))*?\n         \\s+%s=[\'"]?%s[\'"]?\n         (?:\\s+[a-zA-Z0-9:._-]+(?:=[a-zA-Z0-9:._-]+|="[^"]+"|=\'[^\']+\'))*?\n        \\s*>\n        (?P<content>.*?)\n        </\\1>\n    ' % (re.escape(attribute), re.escape(value))), html)
 if (not m):
  return None
 res = m.group(u'content')
 if (res.startswith(u'"') or res.startswith(u"'")):
  res = res[1:(-1)]
 return unescapeHTML(res)

def get_element_by_attribute ( attribute , value , html ) : m = re . search ( ( u'(?xs)\n        <([a-zA-Z0-9:._-]+)\n         (?:\\s+[a-zA-Z0-9:._-]+(?:=[a-zA-Z0-9:._-]+|="[^"]+"|=\'[^\']+\'))*?\n         \\s+%s=[\'"]?%s[\'"]?\n         (?:\\s+[a-zA-Z0-9:._-]+(?:=[a-zA-Z0-9:._-]+|="[^"]+"|=\'[^\']+\'))*?\n        \\s*>\n        (?P<content>.*?)\n        </\\1>\n    ' % ( re . escape ( attribute ) , re . escape ( value ) ) ) , html ) if ( not m ) : return None res = m . group ( u'content' ) if ( res . startswith ( u'"' ) or res . startswith ( u"'" ) ) : res = res [ 1 : ( - 1 ) ] return unescapeHTML ( res )
return the content of the tag with the specified attribute in the passed html document .