code: function checkTask(taskPath, taskIdToCheck, options) {
      const func = function () {
          const deferred = q.defer();
          this.list(`${taskPath}/${taskIdToCheck}`, undefined, util.NO_RETRY)
              .then((response) => {
                  const statusAttribute = (options && options.statusAttribute)
                      ? options.statusAttribute
                      : '_taskState';
                  const taskState = response[statusAttribute];
                  if (taskState === 'VALIDATING' || taskState === 'STARTED') {
                      // this is a normal state, just not done yet - keep waiting
                      deferred.reject();
                  } else if (taskState === 'COMPLETED' || taskState === 'FINISHED') {
                      deferred.resolve({ success: true, response });
                  } else if (taskState === 'FAILED') {
                      deferred.resolve({ success: false, response });
                  } else {
                      deferred.reject(new Error(`checkTask: unexpected command status: ${taskState}`));
                  }
              })
              .catch(() => {
                  // if this throws, assume it is because restjavad has been restarted
                  // and we are done for now
                  deferred.resolve({ success: true });
              });
  
          return deferred.promise;
      };
  
      return util.tryUntil(this, util.DEFAULT_RETRY, func);
  }
docs: Checks status of iControl REST task
  
  @param {String} taskPath                     - URL that created the task
  @param {String} taskIdToCheck                - ID of task as returned by create
  @param {Object} [options]                    - Options for parsing task response
  @param {String} [options.statusAttribute]    - Name of the Task Status attribute in the result response.
  Default: '_taskState'
  
  @returns {Promise} A promise which is resolved with true if the task completes
  successfully, resolved with false if task goes to error state
  or rejected if some other error occurs.