def get_packet(bytes_in):
    """
    Get a properly formatted Dynamixel packet with header and checksum. 
    
    :param bytes_in: A list of bytes in the form ``[b0, b1, b2, ..., bn]``
        
    :returns: A packet in the form of a list of bytes.
    """
    packet_bytes = [255, 255] + bytes_in
    checksum = 0
    for i in range(2, len(packet_bytes)):
        b = packet_bytes[i]
        checksum += b
    checksum = ~checksum & 255
    packet_bytes.append(checksum)
    return packet_bytes
