# Buggy code
def __init__(self, timestamp, timestamp_description, data_type=None):
    """Initializes an event object.

    Args:
      timestamp (int): timestamp, which contains the number of microseconds
          since January 1, 1970, 00:00:00 UTC.
      timestamp_description (str): description of the usage of the timestamp
          value.
      data_type (Optional[str]): event data type. If the data type is not set
          it is derived from the DATA_TYPE class attribute.
    """
    super(TimestampEvent, self).__init__()
    self.timestamp = timestamp
    self.timestamp_desc = timestamp_description

    if data_type:
        self.data_type = data_type


# Traceback (TypeError)
2016-07-21 12:52:47,488 [WARNING] (Worker_01 ) PID:8090 <worker_process> Unhandled exception while processing path spec: OS:/home/onager/code/plaso_onager/test_data/selinux.log.
2016-07-21 12:52:47,489 [ERROR] (Worker_01 ) PID:8090 <worker_process> ([u'UNKNOWN[', u'1323', u']'], {u'key': [(u'type', 0)], u'value': [(u'UNKNOWN[', 0)]}) is not JSON serializable
Traceback (most recent call last):
File "/home/onager/code/plaso_onager/plaso/multi_processing/worker_process.py", line 245, in _ProcessPathSpec
extraction_worker.ProcessPathSpec(parser_mediator, path_spec)
File "/home/onager/code/plaso_onager/plaso/engine/worker.py", line 679, in ProcessPathSpec
self._ProcessFileEntry(parser_mediator, file_entry)
File "/home/onager/code/plaso_onager/plaso/engine/worker.py", line 540, in _ProcessFileEntry
parser_mediator, file_entry, data_stream.name)
File "/home/onager/code/plaso_onager/plaso/engine/worker.py", line 629, in _ProcessFileEntryDataStream
parser_mediator, file_entry, data_stream_name)
File "/home/onager/code/plaso_onager/plaso/engine/extractors.py", line 248, in ParseDataStream
parser_mediator, parser, file_entry, file_object=file_object)
File "/home/onager/code/plaso_onager/plaso/engine/extractors.py", line 185, in _ParseFileEntryWithParser
parser.Parse(parser_mediator, file_object)
File "/home/onager/code/plaso_onager/plaso/parsers/interface.py", line 269, in Parse
self.ParseFileObject(parser_mediator, file_object, **kwargs)
File "/home/onager/code/plaso_onager/plaso/parsers/text_parser.py", line 477, in ParseFileObject
parser_mediator, use_key, parsed_structure)
File "/home/onager/code/plaso_onager/plaso/parsers/selinux.py", line 151, in ParseRecord
parser_mediator.ProduceEvent(event_object)
File "/home/onager/code/plaso_onager/plaso/parsers/mediator.py", line 488, in ProduceEvent
self._storage_writer.AddEvent(event_object)
File "/home/onager/code/plaso_onager/plaso/storage/zip_file.py", line 2903, in AddEvent
self._storage_file.AddEvent(event)
File "/home/onager/code/plaso_onager/plaso/storage/gzip_file.py", line 110, in AddEvent
self._WriteAttributeContainer(event)
File "/home/onager/code/plaso_onager/plaso/storage/gzip_file.py", line 84, in _WriteAttributeContainer
attribute_container)
File "/home/onager/code/plaso_onager/plaso/storage/interface.py", line 237, in _SerializeAttributeContainer
attribute_container)
File "/home/onager/code/plaso_onager/plaso/serializer/json_serializer.py", line 421, in WriteSerialized
return json.dumps(json_dict)
File "/usr/lib/python2.7/json/__init__.py", line 244, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: ([u'UNKNOWN[', u'1323', u']'], {u'key': [(u'type', 0)], u'value': [(u'UNKNOWN[', 0)]}) is not JSON serializable

# Fixed code
def __init__(self, timestamp, timestamp_description, data_type=None):
    """Initializes an event.

    Args:
      timestamp (int): timestamp, which contains the number of microseconds
          since January 1, 1970, 00:00:00 UTC.
      timestamp_description (str): description of the usage of the timestamp
          value.
      data_type (Optional[str]): event data type. If the data type is not set
          it is derived from the DATA_TYPE class attribute.
    """
    super(TimestampEvent, self).__init__()
    self.timestamp = timestamp
    self.timestamp_desc = timestamp_description

    if data_type:
        self.data_type = data_type