code: def _check_stage_complete(self):
          
  
          try:
  
              for task in self._tasks:
                  if task.state not in [states.DONE, states.FAILED]:
                      return False
  
              return True
  
          except Exception, ex:
              raise EnTKError(ex)
docs: Purpose: Check if all tasks of the current stage have completed, i.e., are in either DONE or FAILED state.