! @brief Look for pairs of data trace events and merge.

def _merge_data_trace_events(self, event):
        """! @brief Look for pairs of data trace events and merge."""
        if isinstance(event, events.TraceDataTraceEvent):
            # Record the first data trace event.
            if self._pending_data_trace is None:
                self._pending_data_trace = event
            else:
                # We've got the second in a pair. If the comparator numbers are the same, then
                # we can merge the two events. Otherwise we just add them to the pending event
                # queue separately.
                if event.comparator == self._pending_data_trace.comparator:
                    # Merge the two data trace events.
                    ev = events.TraceDataTraceEvent(cmpn=event.comparator,
                        pc=(event.pc or self._pending_data_trace.pc),
                        addr=(event.address or self._pending_data_trace.address),
                        value=(event.value or self._pending_data_trace.value),
                        rnw=(event.is_read or self._pending_data_trace.is_read),
                        sz=(event.transfer_size or self._pending_data_trace.transfer_size),
                        ts=self._pending_data_trace.timestamp)
                else:
                    ev = self._pending_data_trace
                self._pending_events.append(ev)
                self._pending_data_trace = None
            return True
        # If we get a non-data-trace event while waiting for a second data trace event, then
        # just place the pending data trace event in the pending event queue.
        elif self._pending_data_trace is not None:
            self._pending_events.append(self._pending_data_trace)
            self._pending_data_trace = None
        return False