code: function chain_requests(ml, url) {
    return (batches) => {
      let promise = new Promise((resolve, reject) => resolve(new MonkeyLearnResponse()));
  
      // attach requests for all the batches sequentially to the original promise and return _that_
      return batches.reduce((promise, batch) =>
        promise.then((response) =>
  
          request(ml, {
            url: url,
            method: 'POST',
            body: batch,
            parse_response: false
          })
  
          .then(raw_response => {
            response._add_raw_response(raw_response);
            return response;
          })
  
          .catch(error => {
            if (error.hasOwnProperty('response')) {
              response._add_raw_response(error.response);
              error.response = response;
            } else {
              // if it's not a MonkeyLearn Error (so, some other js runtime error),
              // return as-is but add the response
              // not the cleanest solution but I don't want the error to lose the context
              error.response = response;
              error.error_code = '';
            }
            throw error;
          })
        )
      , promise)
    }
  }
docs: returns a function that takes an array of batches and generates a request for each the requests are done sequentially