def eventAsJSON(event):
 if (bytes is str):
  kw = dict(default=objectSaveHook, encoding='charmap', skipkeys=True)
 else:
  def default(unencodable):
   '\n            Serialize an object not otherwise serializable by L{dumps}.\n\n            @param unencodable: An unencodable object.\n            @return: C{unencodable}, serialized\n            '
   if isinstance(unencodable, bytes):
    return unencodable.decode('charmap')
   return objectSaveHook(unencodable)
  kw = dict(default=default, skipkeys=True)
 flattenEvent(event)
 result = dumps(event, **kw)
 if (not isinstance(result, unicode)):
  return unicode(result, 'utf-8', 'replace')
 return result

def eventAsJSON ( event ) : if ( bytes is str ) : kw = dict ( default = objectSaveHook , encoding = 'charmap' , skipkeys = True ) else : def default ( unencodable ) : if isinstance ( unencodable , bytes ) : return unencodable . decode ( 'charmap' ) return objectSaveHook ( unencodable ) kw = dict ( default = default , skipkeys = True ) flattenEvent ( event ) result = dumps ( event , ** kw ) if ( not isinstance ( result , unicode ) ) : return unicode ( result , 'utf-8' , 'replace' ) return result
encode an event as json .