def search(values):
    "Apply depth first search to solve Sudoku puzzles in order to solve puzzles\n    that cannot be solved by repeated reduction alone.\n\n    Parameters\n    ----------\n    values(dict)\n        a dictionary of the form {'box_name': '123456789', ...}\n\n    Returns\n    -------\n    dict or False\n        The values dictionary with all boxes assigned or False\n\n    Notes\n    -----\n    You should be able to complete this function by copying your code from the classroom\n    and extending it to call the naked twins strategy.\n    "
    'Using depth-first search and propagation, try all possible values.'
    values = reduce_puzzle(values)
    if (values is False):
        return False
    if all(((len(values[s]) == 1) for s in boxes)):
        return values
    (n, s) = min(((len(values[s]), s) for s in boxes if (len(values[s]) > 1)))
    for value in values[s]:
        new_sudoku = values.copy()
        new_sudoku[s] = value
        attempt = search(new_sudoku)
        if attempt:
            return attempt
Apply depth first search to solve Sudoku puzzles in order to solve puzzles
that cannot be solved by repeated reduction alone.

Parameters
----------
values(dict)
    a dictionary of the form {'box_name': '123456789', ...}

Returns
-------
dict or False
    The values dictionary with all boxes assigned or False

Notes
-----
You should be able to complete this function by copying your code from the classroom
and extending it to call the naked twins strategy.
def search(values):
    "Apply depth first search to solve Sudoku puzzles in order to solve puzzles\n    that cannot be solved by repeated reduction alone.\n\n    Parameters\n    ----------\n    values(dict)\n        a dictionary of the form {'box_name': '123456789', ...}\n\n    Returns\n    -------\n    dict or False\n        The values dictionary with all boxes assigned or False\n\n    Notes\n    -----\n    You should be able to complete this function by copying your code from the classroom\n    and extending it to call the naked twins strategy.\n    "
    'Using depth-first search and propagation, try all possible values.'
    values = reduce_puzzle(values)
    if (values is False):
        return False
    if all(((len(values[s]) == 1) for s in boxes)):
        return values
    (n, s) = min(((len(values[s]), s) for s in boxes if (len(values[s]) > 1)))
    for value in values[s]:
        new_sudoku = values.copy()
        new_sudoku[s] = value
        attempt = search(new_sudoku)
        if attempt:
            return attempt