code: def solve(self, verbose=False, allow_brute_force=True):
          while not self.is_solved:
              self._update()
              singles_found = False or self._fill_naked_singles() or self._fill_hidden_singles()
              if not singles_found:
                  if allow_brute_force:
                      solution = None
                      try:
                          dlxs = DancingLinksSolver(copy.deepcopy(self._matrix))
                          solutions = dlxs.solve()
                          solution = next(solutions)
                          more_solutions = next(solutions)
                      except StopIteration as e:
                          if solution is not None:
                              self._matrix = solution
                          else:
                              raise SudokuHasNoSolutionError("Dancing Links solver could not find any solution.")
                      except Exception as e:
                          raise SudokuHasNoSolutionError("Brute Force method failed.")
                      else:
                          raise SudokuHasMultipleSolutionsError("This Sudoku has multiple solutions!")
                      self.solution_steps.append("BRUTE FORCE - Dancing Links")
                      break
                  else:
                      print(self)
                      raise SudokuTooDifficultError("This Sudoku requires more advanced methods!")
          if verbose:
              print("Sudoku solved in {0} iterations!\n{1}".format(len(self.solution_steps), self))
              for step in self.solution_steps:
                  print(step)