code: function NickservMiddleware() {
  	return function(client, raw_events, parsed_events) {
  		raw_events.use(theMiddleware);
  	};
  
  
  	function theMiddleware(command, event, client, next) {
  		if (command === '005') {
  			if (client.options.nickserv) {
  				var options = client.options.nickserv;
  				client.say('nickserv', 'identify ' + options.account + ' ' + options.password);
  			}
  		}
  
  		if (command === 'PRIVMSG' && event.params[0].toLowerCase() === 'nickserv') {
  			// Handle success/retries/failures
  		}
  
  		next();
  	}
  }
docs: Example middleware structure to handle NickServ authentication
  Accepts a `nickserv` object from the client connect() options