def handleAttributes(text, parent):
 def attributeCallback(match):
  parent.set(match.group(1), match.group(2).replace(u'\n', u' '))
 return ATTR_RE.sub(attributeCallback, text)

def handleAttributes ( text , parent ) : def attributeCallback ( match ) : parent . set ( match . group ( 1 ) , match . group ( 2 ) . replace ( u'\n' , u' ' ) ) return ATTR_RE . sub ( attributeCallback , text )
set values of an element based on attribute definitions .