code: def _track_tasks(task_ids, cluster):
      
      while True:
          statuses = _get_task_statuses(task_ids, cluster)
          if all([status == 'STOPPED' for status in statuses]):
              logger.info('ECS tasks {0} STOPPED'.format(','.join(task_ids)))
              break
          time.sleep(POLL_TIME)
          logger.debug('ECS task status for tasks {0}: {1}'.format(task_ids, statuses))
docs: Poll task status until STOPPED