<s> """<STR_LIT>""" <EOL> NS_WSA = '<STR_LIT>' <EOL> URI_ANONYMOUS = '<STR_LIT>' <EOL> URI_UNSPECIFIED = '<STR_LIT>' <EOL> def append_wsa_headers ( <EOL> msg , to , action , <EOL> message_id = None , <EOL> relates_to = None , <EOL> relationship_type = None , <EOL> reply_to = None , <EOL> from_endpoint = None , <EOL> fault_to = None , <EOL> ) : <EOL> """<STR_LIT>""" <EOL> if reply_to and not message_id : <EOL> raise ValueError ( <EOL> '<STR_LIT>' , <EOL> ) <EOL> if fault_to and not message_id : <EOL> raise ValueError ( <EOL> '<STR_LIT>' , <EOL> ) <EOL> if relationship_type and not relates_to : <EOL> raise ValueError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> ) <EOL> msg [ '<STR_LIT>' ] = '<STR_LIT>' . format ( action ) <EOL> relation_attrs = { } <EOL> if relationship_type : <EOL> relation_attrs [ '<STR_LIT>' ] = relationship_type <EOL> wsa = msg . elementmaker ( '<STR_LIT>' , NS_WSA ) <EOL> msg . headers . extend ( <EOL> header <EOL> for header <EOL> in [ <EOL> wsa . MessageID ( message_id ) if message_id else None , <EOL> wsa . RelatesTo ( relates_to , ** relation_attrs ) if relates_to else None , <EOL> wsa . To ( to ) , <EOL> wsa . Action ( action ) , <EOL> wsa . From ( from_endpoint ) if from_endpoint else None , <EOL> wsa . ReplyTo ( wsa . Address ( reply_to ) ) if reply_to else None , <EOL> wsa . FaultTo ( wsa . Address ( fault_to ) ) if fault_to else None , <EOL> ] <EOL> if header is not None <EOL> ) </s>
