code: def iterative_limited_depth_first(problem, graph_search=False, viewer=None):
      '''
      Iterative limited depth first search.
  
      If graph_search=True, will avoid exploring repeated states.
      Requires: SearchProblem.actions, SearchProblem.result, and
      SearchProblem.is_goal.
      '''
      solution = None
      limit = 0
  
      while not solution:
          solution = limited_depth_first(problem,
                                         depth_limit=limit,
                                         graph_search=graph_search,
                                         viewer=viewer)
          limit += 1
  
      if viewer:
          viewer.event('no_more_runs', solution, 'returned after %i runs' % limit)
  
      return solutiof iterative_limited_depth_first(problem, graph_search=False, viewer=None):
      '''
      Iterative limited depth first search.
  
      If graph_search=True, will avoid exploring repeated states.
      Requires: SearchProblem.actions, SearchProblem.result, and
      SearchProblem.is_goal.
      '''
      solution = None
      limit = 0
  
      while not solution:
          solution = limited_depth_first(problem,
                                         depth_limit=limit,
                                         graph_search=graph_search,
                                         viewer=viewer)
          limit += 1
  
      if viewer:
          viewer.event('no_more_runs', solution, 'returned after %i runs' % limit)
  
      return solution
docs: Iterative limited depth first search.
  
      If graph_search=True, will avoid exploring repeated states.
      Requires: SearchProblem.actions, SearchProblem.result, and
      SearchProblem.is_goal.