Given a list of packet events events, where each event is a pair [timestamp, event_id] sorted by non-decreasing timestamp, and an integer window_size, return True if any event_id appears at least twice such that the difference between the two timestamps is at most window_size. Otherwise, return False.
def has_duplicate_event_within_window(events, window_size):