def scan_for_bombs(board, n_bomb, row, column):
    """
    Finds and potentially marks bombs and neighbors eligible to be openened.
    Returns a dict of squares to open and squares, whos neighbors should be inspected.
    """
    bombs = 0                        # Bombs discovered
    unopened_neighbors = []          # Unopened neighbors  
    val = int(board[row][column])    # Value of this square (number of bombs for neighbor)
    
    # Bombs are discovered and unopened neighbors are found
    for i in range(max(0, row - 1), min(len(board), row + 2)):
        for j in range(max(0, column - 1), min(len(board[0]), column + 2)):
            if board[i][j] is "x":
                bombs += 1
            elif board[i][j] is "?":
                unopened_neighbors.append((i, j))
    
    # Updates the number of bombs found for this square
    n_bomb[row][column] = bombs
    
    # Squares to open and bombs to mark are found. 
    # "update" are squares that shall notify their neighbors to re-inspect.
    updates = {"update": []}
    if bombs == val:
        # Neighbors can be opened if the required number of bombs are discovered already
        updates["open"] = unopened_neighbors
    elif bombs + len(unopened_neighbors) == val:
        # Bombs can be marked and their neighbors updated
        for r, c in unopened_neighbors:
            board[r][c] = "x"
        updates["update"] = unopened_neighbors
    return updates