code: def lease(self, seconds=600, num_tasks=1, tag=None):
      
      tag = tag if tag else None
      tasks = self._api.lease(
        numTasks=num_tasks, 
        seconds=seconds,
        groupByTag=(tag is not None),
        tag=tag,
      )
  
      if not len(tasks):
        raise QueueEmpty
  
      task = tasks[0]
      return totask(task)
docs: Acquires a lease on the topmost N unowned tasks in the specified queue.
      Required query parameters: leaseSecs, numTasks