def encode_packet(packet: dict) -> str:
if packet['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>return '<STR_LIT>' + packet['<STR_LIT>'] + '<STR_LIT:;>'<EOL><DEDENT>elif packet['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>return '<STR_LIT>' + packet['<STR_LIT>'] + '<STR_LIT:;>'<EOL><DEDENT>else:<EOL><INDENT>return SWITCH_COMMAND_TEMPLATE.format(<EOL>node=PacketHeader.master.value,<EOL>**packet<EOL>)<EOL><DEDENT>
Construct packet string from packet dictionary.

    >>> encode_packet({
    ...     'protocol': 'newkaku',
    ...     'id': '000001',
    ...     'switch': '01',
    ...     'command': 'on',
    ... })
    '10;newkaku;000001;01;on;'