def SafeFormatMessage(eventLogRecord, logType=None):
 if (logType is None):
  logType = 'Application'
 try:
  return FormatMessage(eventLogRecord, logType)
 except win32api.error:
  if (eventLogRecord.StringInserts is None):
   desc = ''
  else:
   desc = u', '.join(eventLogRecord.StringInserts)
  return (u'<The description for Event ID ( %d ) in Source ( %r ) could not be found. It contains the following insertion string(s):%r.>' % (winerror.HRESULT_CODE(eventLogRecord.EventID), eventLogRecord.SourceName, desc))

def SafeFormatMessage ( eventLogRecord , logType = None ) : if ( logType is None ) : logType = 'Application' try : return FormatMessage ( eventLogRecord , logType ) except win32api . error : if ( eventLogRecord . StringInserts is None ) : desc = '' else : desc = u', ' . join ( eventLogRecord . StringInserts ) return ( u'<The description for Event ID ( %d ) in Source ( %r ) could not be found. It contains the following insertion string(s):%r.>' % ( winerror . HRESULT_CODE ( eventLogRecord . EventID ) , eventLogRecord . SourceName , desc ) )
as for formatmessage .