docs: function(cb) {
    return function(err, res, body) {
      if (typeof cb !== 'function') return;
  
      // Catch connection errors
      if (err || !res) {
        var returnErr = 'Error connecting to Unbabel';
        if (err) returnErr += ': ' + err.code;
        err = returnErr;
      } else if (res.statusCode !== 200 && res.statusCode !== 201 && res.statusCode !== 202) {
        err = 'Something went wrong. Unbabel responded with a ' + res.statusCode;
      }
      if (err) return cb(err, null);
  
      // Try to parse response
      if (body !== Object(body)) {
        try {
          body = JSON.parse(body);
        } catch(e) {
          return cb('Could not parse response from Unbabel: ' + body, null);
        }
      }
  
      // Check for error returned in a 200 response
      if (body.opstat === 'error') {
        if (body.err) return cb(body.err);
        return cb(err);
      }
  
      // Make sure response is OK
      if (body.opstat === 'ok') body = body.response;
  
      // Return response
      cb(null, body);
    };
  }