code: function cbify(fn) {
    return function callbackable() {
      var length = arguments.length
        , done = arguments[length - 1];
  
      if (length > fn.length && _.isFunction(done)) {
        try { done(null, fn.apply(this, arguments)); } catch(e) { done(e); }
      }
  
      else { fn.apply(this, arguments); }
    };
  }
docs: https://gist.github.com/2385351