# Buggy code
def __init__(self, uuid, timestamp_description):
    """Initializes an event object.

    Args:
      uuid (uuid.UUID): UUID object.
      timestamp_description (str): description of the usage of the timestamp
          value.

    Raises:
      ValueError: if the UUID version is not supported.
    """
    if uuid.version != 1:
        raise ValueError("Unsupported UUID version.")

    timestamp = timelib.Timestamp.FromUUIDTime(uuid.time)
    mac_address = "{0:s}:{1:s}:{2:s}:{3:s}:{4:s}:{5:s}".format(
        uuid.hex[20:22],
        uuid.hex[22:24],
        uuid.hex[24:26],
        uuid.hex[26:28],
        uuid.hex[28:30],
        uuid.hex[30:32],
    )
    super(UUIDTimeEvent, self).__init__(timestamp, timestamp_description)

    self.mac_address = mac_address
    self.uuid = "{0!s}".format(uuid)


# 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, uuid, timestamp_description):
    """Initializes an event.

    Args:
      uuid (uuid.UUID): UUID.
      timestamp_description (str): description of the usage of the timestamp
          value.

    Raises:
      ValueError: if the UUID version is not supported.
    """
    if uuid.version != 1:
        raise ValueError("Unsupported UUID version.")

    timestamp = timelib.Timestamp.FromUUIDTime(uuid.time)
    mac_address = "{0:s}:{1:s}:{2:s}:{3:s}:{4:s}:{5:s}".format(
        uuid.hex[20:22],
        uuid.hex[22:24],
        uuid.hex[24:26],
        uuid.hex[26:28],
        uuid.hex[28:30],
        uuid.hex[30:32],
    )
    super(UUIDTimeEvent, self).__init__(timestamp, timestamp_description)

    self.mac_address = mac_address
    self.uuid = "{0!s}".format(uuid)