#NEWLINE# def _prepare_xml( options = None , state = None ) : #NEWLINE# #INDENT# '\n    Get the requests options from salt.\n    ' #NEWLINE# if state : #NEWLINE# #INDENT# _state = '0' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _state = '2' #NEWLINE# #UNINDENT# xml = "<?xml version='1.0'?>\n<checkresults>\n" #NEWLINE# if ( ( 'service' in options ) and ( options [ 'service' ] != '' ) ) : #NEWLINE# #INDENT# xml += ( ( "<checkresult type='service' checktype='" + str ( options [ 'checktype' ] ) ) + "'>" ) #NEWLINE# xml += ( ( '<hostname>' + cgi . escape ( options [ 'hostname' ] , True ) ) + '</hostname>' ) #NEWLINE# xml += ( ( '<servicename>' + cgi . escape ( options [ 'service' ] , True ) ) + '</servicename>' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# xml += ( ( "<checkresult type='host' checktype='" + str ( options [ 'checktype' ] ) ) + "'>" ) #NEWLINE# xml += ( ( '<hostname>' + cgi . escape ( options [ 'hostname' ] , True ) ) + '</hostname>' ) #NEWLINE# #UNINDENT# xml += ( ( '<state>' + _state ) + '</state>' ) #NEWLINE# if ( 'output' in options ) : #NEWLINE# #INDENT# xml += ( ( '<output>' + cgi . escape ( options [ 'output' ] , True ) ) + '</output>' ) #NEWLINE# #UNINDENT# xml += '</checkresult>' #NEWLINE# xml += '\n</checkresults>' #NEWLINE# return xml