def create_magic_packet(macaddress):
if len(macaddress) == <NUM_LIT:12>:<EOL><INDENT>pass<EOL><DEDENT>elif len(macaddress) == <NUM_LIT>:<EOL><INDENT>sep = macaddress[<NUM_LIT:2>]<EOL>macaddress = macaddress.replace(sep, '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>data = b'<STR_LIT>' + (macaddress * <NUM_LIT:16>).encode()<EOL>send_data = b'<STR_LIT>'<EOL>for i in range(<NUM_LIT:0>, len(data), <NUM_LIT:2>):<EOL><INDENT>send_data += struct.pack(b'<STR_LIT:B>', int(data[i: i + <NUM_LIT:2>], <NUM_LIT:16>))<EOL><DEDENT>return send_data<EOL>
Create a magic packet.

A magic packet is a packet that can be used with the for wake on lan
protocol to wake up a computer. The packet is constructed from the
mac address given as a parameter.

Args:
    macaddress (str): the mac address that should be parsed into a
        magic packet.