code: def serialize_packet_id(packet: dict) -> str:
      
      # translate protocol in something reversable
      protocol = protocol_translations[packet['protocol']]
  
      if protocol == UNKNOWN:
          protocol = 'rflink'
  
      return '_'.join(filter(None, [
          protocol,
          packet.get('id', None),
          packet.get('switch', None),
      ]))
docs: Serialize packet identifiers into one reversable string.
  
      >>> serialize_packet_id({
      ...     'protocol': 'newkaku',
      ...     'id': '000001',
      ...     'switch': '01',
      ...     'command': 'on',
      ... })
      'newkaku_000001_01'
      >>> serialize_packet_id({
      ...     'protocol': 'ikea koppla',
      ...     'id': '000080',
      ...     'switch': '0',
      ...     'command': 'on',
      ... })
      'ikeakoppla_000080_0'
      >>> # unserializeable protocol name without explicit entry
      >>> # in translation table should be properly serialized
      >>> serialize_packet_id({
      ...     'protocol': 'alecto v4',
      ...     'id': '000080',
      ...     'switch': '0',
      ...     'command': 'on',
      ... })
      'alectov4_000080_0'