Stitches blocks together into a single block columnwise. These blocks are 2D tables usually
    generated from tableproc. The final block will be of dimensions (max(num_rows), sum(num_cols)).

def stitch_block(block_list):
    '''
    Stitches blocks together into a single block columnwise. These blocks are 2D tables usually
    generated from tableproc. The final block will be of dimensions (max(num_rows), sum(num_cols)).
    '''
    block_out = [[]]
    for block in block_list:
        num_row = len(block)
        row_len = len(block[0])
        if len(block_out) < num_row:
            for i in range(num_row-len(block_out)):
                block_out.append([None]*len(block_out[0]))
        for row_out, row_in in zip(block_out, block):
            row_out.extend(row_in)
        if len(block_out) > num_row:
            for row_out in block_out[num_row:]:
                row_out.extend([None]*row_len)
    return block_out