code: def _format_checkresult(**kwargs):
      
      o = {}
      o['check_type'] = '1'
      o['check_options'] = '0'
      o['scheduled_check'] = '1'
      o['reschedule_check'] = '1'
      o['latency'] = '0.0'
      o['start_time'] = '%5f' % time.time()
      o['finish_time'] = '%5f' % time.time()
      o['early_timeout'] = '0'
      o['exited_ok'] = '1'
      o['long_plugin_output'] = ''
      o['performance_data'] = ''
      o.update(locals())
      o.update(kwargs)
      del o['kwargs']
      del o['o']
  
      template = _host_check_result
      # Escape all linebreaks if we have them
      for k, v in o.items():
          if isinstance(v, basestring) and '\n' in v:
              o[k] = v.replace('\n', '\\n')
  
      # Livestatus returns slightly different output than status.dat
      # Lets normalize everything to status.dat format
      if 'name' in o and not 'host_name' in o:
          o['host_name'] = o['name']
      if 'state' in o and not 'return_code' in o:
          o['return_code'] = o['state']
      if 'description' in o and not 'service_description' in o:
          o['service_description'] = o['description']
      if not o['performance_data'] and 'perf_data' in o:
          o['performance_data'] = o['perf_data']
  
      # If this is a service (as opposed to host) lets add service_description field in out putput
      if 'service_description' in o:
          template += "service_description={service_description}\n"
      if not o['performance_data'].endswith('\\n'):
          o['performance_data'] += '\\n'
  
      # Format the string and return
      return template.format(**o) + '\n'
docs: Returns a string in a nagios "checkresults" compatible format