def formatEvent(event):
 try:
  if ('log_flattened' in event):
   return flatFormat(event)
  format = event.get('log_format', None)
  if (format is None):
   return u''
  if isinstance(format, bytes):
   format = format.decode('utf-8')
  elif (not isinstance(format, unicode)):
   raise TypeError('Log format must be unicode or bytes, not {0!r}'.format(format))
  return formatWithCall(format, event)
 except Exception as e:
  return formatUnformattableEvent(event, e)

def formatEvent ( event ) : try : if ( 'log_flattened' in event ) : return flatFormat ( event ) format = event . get ( 'log_format' , None ) if ( format is None ) : return u'' if isinstance ( format , bytes ) : format = format . decode ( 'utf-8' ) elif ( not isinstance ( format , unicode ) ) : raise TypeError ( 'Log format must be unicode or bytes, not {0!r}' . format ( format ) ) return formatWithCall ( format , event ) except Exception as e : return formatUnformattableEvent ( event , e )
formats an event as a l{unicode} .