code: def serialize(self):
          
  
          log_items = []
  
          data = msgpack.unpackb(self.data, raw=False)
          for item in data.items():
              value_to_store = (
                  None
                  if not isinstance(item[1], numbers.Number)
                  or isinf(item[1])
                  or isnan(item[1])
                  else item[1]
              )
  
              log_items.append({
                  'logId': self.id,
                  'key': item[0],
                  'value': value_to_store
              })
  
          return {
              'id': self.id,
              'resultId': self.result_id,
              'logItems': log_items
          }
docs: serialize.