def solve(board):
    """Return a solved Sudoku board (None if no solution was found)."""
    pos = get_more_constrained_square(board)
    if not pos:
        return board # all squares are filled, so this board is the solution
    nrow, ncolumn = pos
    for test_digit in get_alternatives_for_square(board, nrow, ncolumn):
        test_board = copy_board(board, {(nrow, ncolumn): test_digit})
        solved_board = solve(test_board)
        if solved_board:
            return solved_board
Return a solved Sudoku board (None if no solution was found).
recipes/Python/577188_Sudoku_solver_functionalprogramming/recipe-577188.py