code: def get_next_task(self):
          
          if _debug: TaskManager._debug("get_next_task")
  
          # get the time
          now = _time()
  
          task = None
          delta = None
  
          if self.tasks:
              # look at the first task
              when, n, nxttask = self.tasks[0]
              if when <= now:
                  # pull it off the list and mark that it's no longer scheduled
                  heappop(self.tasks)
                  task = nxttask
                  task.isScheduled = False
  
                  if self.tasks:
                      when, n, nxttask = self.tasks[0]
                      # peek at the next task, return how long to wait
                      delta = max(when - now, 0.0)
              else:
                  delta = when - now
  
          # return the task to run and how long to wait for the next one
          return (task, delta)
docs: get the next task if there's one that should be processed,
          and return how long it will be until the next one should be
          processed.