code: def decode_tx_packet(packet: str) -> dict:
      
      node_id, protocol, attrs = packet.split(DELIM, 2)
  
      data = cast(Dict[str, Any], {
          'node': PacketHeader(node_id).name,
      })
  
      data['protocol'] = protocol.lower()
  
      for i, attr in enumerate(filter(None, attrs.strip(DELIM).split(DELIM))):
          if i == 0:
              data['id'] = attr
          if i == 1:
              data['switch'] = attr
          if i == 2:
              data['command'] = attr
  
      # correct KaKu device address
      if data.get('protocol', '') == 'kaku' and len(data['id']) != 6:
          data['id'] = '0000' + data['id']
  
      return data
docs: Break packet down into primitives, and do basic interpretation.
  
      >>> decode_packet('10;Kaku;ID=41;SWITCH=1;CMD=ON;') == {
      ...     'node': 'gateway',
      ...     'protocol': 'kaku',
      ...     'id': '000041',
      ...     'switch': '1',
      ...     'command': 'on',
      ... }
      True