Finds the end of a block from a start location and a suggested end location.

def _find_block_end(self, table, used_cells, block_start, block_end, start_pos, end_pos):
        '''
        Finds the end of a block from a start location and a suggested end location.
        '''
        table_row = table[block_start[0]]
        used_row = used_cells[block_start[0]]
        table_transpose = TableTranspose(table)

        # Find which column the titles end on
        for column_index in range(block_start[1], end_pos[1] + 1):
            # Ensure we catch the edge case of the data reaching the edge of the table -- block_end
            # should then equal end_pos
            block_end[1] = max(block_end[1], column_index)
            if column_index == end_pos[1]:
                break
            if used_row[column_index]:
                break
            elif is_empty_cell(table_row[column_index]):
                table_column = table_transpose[column_index]
                found_cell = False
                for row_index in range(block_start[0], block_end[0]):
                    if not is_empty_cell(table_column[row_index]):
                        found_cell = True
                        break
                # If we have a column of blanks, stop
                if not found_cell:
                    break
        return block_start, block_end