<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def boot_packet(sock, cmd, arg1=0, arg2=0, arg3=0, data=b""):
 """Create and transmit a packet to boot the machine. Parameters sock : :py:class:`~socket.socket` Connected socket to use to transmit the packet. cmd : int arg1 : int arg2 : int arg3 : int data : :py:class:`bytes` Optional data to include in the packet. """

    PROTOCOL_VERSION = 1

    # Generate the (network-byte order) header
    header = struct.pack("!H4I", PROTOCOL_VERSION, cmd, arg1, arg2, arg3)

    assert len(data) % 4 == 0  # Data should always be word-sized
    fdata = b""

    # Format the data from little- to network-/big-endian
    while len(data) > 0:
        word, data = (data[:4], data[4:])
        fdata += struct.pack("!I", struct.unpack("<I", word)[0])

    # Transmit the packet
    sock.send(header + fdata)