bgwrite_chunk - Chunk up the data into even #chunkSize blocks, and then pass it onto #bgwrite.
            Use this to break up a block of data into smaller segments that can be written and flushed.
            The smaller the chunks, the more interactive (recipient gets data quicker, iowait goes down for you) at cost of throughput.

            bgwrite will automatically chunk according to the given ioPrio, but you can use this for finer-tuned control.

            @see bgwrite

        @param data <string/bytes> - The data to chunk up

        @param chunkSize <integer> - The max siZe of each chunk.

def bgwrite_chunk(fileObj, data, chunkSize, closeWhenFinished=False, chainAfter=None, ioPrio=4):
    '''
        bgwrite_chunk - Chunk up the data into even #chunkSize blocks, and then pass it onto #bgwrite.
            Use this to break up a block of data into smaller segments that can be written and flushed.
            The smaller the chunks, the more interactive (recipient gets data quicker, iowait goes down for you) at cost of throughput.

            bgwrite will automatically chunk according to the given ioPrio, but you can use this for finer-tuned control.

            @see bgwrite

        @param data <string/bytes> - The data to chunk up

        @param chunkSize <integer> - The max siZe of each chunk.
    '''
    chunks = chunk_data(data, chunkSize)

    return bgwrite(fileObj, chunks, closeWhenFinished, chainAfter, ioPrio)