<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def encode_packet(packet: dict) -> str: """Construct packet string from packet dictionary. '10;newkaku;000001;01;on;' """

    if packet['protocol'] == 'rfdebug':
        return '10;RFDEBUG=' + packet['command'] + ';'
    elif packet['protocol'] == 'rfudebug':
        return '10;RFDEBUG=' + packet['command'] + ';'
    else:
        return SWITCH_COMMAND_TEMPLATE.format(
            node=PacketHeader.master.value,
            **packet
        )