code: function checkHttpCode(expected, res, body, callback) {
    if (res.statusCode !== expected) {
      if (!body) {
        return callback(new Error(format('Unexpected deis response (expected %s but %s was returned)', expected, res.statusCode)));
      }
  
      var error = body.hasOwnProperty('detail') ?
          body.detail : JSON.stringify(body);
  
      return callback(new Error(error));
    }
  
    return callback(null, body);
  }
docs: Check if the http response returns the expected http code
  and return an error with the detail if the check fails
  @param  {Number}   expected     http
  @param  {Response} res
  @param  {Object}   body
  @param  {Function} callback