def _prepare_xml(options=None, state=None):

    if state:
        _state = '0'
    else:
        _state = '2'

    xml = "<?xml version='1.0'?>\n<checkresults>\n"

    # No service defined then we set the status of the hostname
    if 'service' in options and options['service'] != '':
        xml += "<checkresult type='service' checktype='"+str(options['checktype'])+"'>"
        xml += "<hostname>"+cgi.escape(options['hostname'], True)+"</hostname>"
        xml += "<servicename>"+cgi.escape(options['service'], True)+"</servicename>"
    else:
        xml += "<checkresult type='host' checktype='"+str(options['checktype'])+"'>"
        xml += "<hostname>"+cgi.escape(options['hostname'], True)+"</hostname>"

    xml += "<state>"+_state+"</state>"

    if 'output' in options:
        xml += "<output>"+cgi.escape(options['output'], True)+"</output>"

    xml += "</checkresult>"

    xml += "\n</checkresults>"

    return xml
Returns the value of a vertex.
dataset/ETHPy150Open saltstack/salt/salt/returners/nagios_return.py/_prepare_xml--crossover with--dataset/ETHPy150Open charanpald/APGL/apgl/graph/AbstractVertexList.py/AbstractVertexList.getVertex