code: def all_ends_of_turn(self, root):
          
          # simple confirmation that the root is actually a root.
          # otherwise it may seem to work but would be totally out of spec
          if root.parent:
              raise ValueError('Unexpectedly received a node with a parent for'
                               ' root:\n{}'.format(root))
          # run a single turn for each eot from a stack
          jobs = [root]
          while jobs:
              random_job_index = random.randint(0, len(jobs) - 1)
              start_eot = jobs.pop(random_job_index)
              # special case: handle the root once
              if start_eot is root:
                  kw_root = {'root': start_eot}
              else:
                  kw_root = {'root_eot': start_eot}
              for eot in self.ends_of_one_state(**kw_root):
                  # only continue simulating non-mana drains
                  if not eot.is_mana_drain:
                      jobs.append(eot)
                  yield eot
docs: Simulate the root and continue generating ends of turn until
          everything has reached mana drain.
  
          Warning on random fill:
          If random fill is used together with this method, it will generate
          basically forever due to the huge number of possibilities it
          introduces.
  
          Arguments:
          root: a start state with no parent
  
          Note on mana drain:
          Generates but does not continue simulation of mana drains.
  
          Note on run time:
          This simulates a complete turn for each eot provided, rather than
          just one branch at a time. The method will only stop generating
          when all possibilities have been simulated or filtered.