<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def packet_events(packet: dict) -> Generator: """Return list of all events in the packet. """

    field_abbrev = {v: k for k, v in PACKET_FIELDS.items()}

    packet_id = serialize_packet_id(packet)
    events = {f: v for f, v in packet.items() if f in field_abbrev}
    if 'command' in events or 'version' in events:
        # switch events only have one event in each packet
        yield dict(id=packet_id, **events)
    else:
        if packet_id == 'debug':
            yield {
                'id': 'raw',
                'value': packet.get('pulses(usec)'),
                'tm': packet.get('tm'),
                'pulses': packet.get('pulses'),
            }
        else:
            # sensors can have multiple
            for sensor, value in events.items():
                unit = packet.get(sensor + '_unit', None)
                yield {
                    'id': packet_id + PACKET_ID_SEP + field_abbrev[sensor],
                    'sensor': sensor,
                    'value': value,
                    'unit': unit,
                }

            if packet_id != 'rflink':
                yield {
                   'id': packet_id + PACKET_ID_SEP + 'update_time',
                   'sensor': 'update_time',
                   'value': round(time.time()),
                   'unit': 's',
                }