def write_binary(data, filename):
    """
        Write binary data to a file on disk
    """
    import struct
    f = open(filename, 'wb+')
    f.write(struct.pack('%dB' % len(data), *data))
    f.close()
