#NEWLINE# def extractHeaders( stanza ) : #NEWLINE# #INDENT# '\n    Extract SHIM headers from stanza.\n\n    @param stanza: The stanza to extract headers from.\n    @type stanza: L{Element<twisted.words.xish.domish.Element>}\n    @return: Headers as a mapping from header name to a list of values.\n    @rtype: C{dict}\n    ' #NEWLINE# headers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for element in domish . generateElementsQNamed ( stanza . children , 'headers' , NS_SHIM ) : #NEWLINE# #INDENT# for header in domish . generateElementsQNamed ( element . children , 'header' , NS_SHIM ) : #NEWLINE# #INDENT# headers . setdefault ( header [ 'name' ] , [ ] ) . append ( unicode ( header ) ) #NEWLINE# #UNINDENT# #UNINDENT# return headers