docs: function (asyncFunction, callbackNotDeclared) {
      var arity = asyncFunction.length;
  
      return function () {
          var deferred = new Deferred(),
              args = slice.call(arguments),
              callback;
          if (callbackNotDeclared && !args[args.length + 1] instanceof Function) {
              arity = args.length + 1;
          }
          callback = args[arity - 1];
  
          args.splice(arity);
          args[arity - 1] = function (error, result) {
              if (error) {
                  deferred.emitError(error);
              } else {
                  if (args.length > 2) {
                      // if there are multiple success values, we return an array
                      args.shift(1);
                      deferred.emitSuccess(args);
                  } else {
                      deferred.emitSuccess(result);
                  }
              }
          };
          asyncFunction.apply(this, args);
  
          //Node old school
          if (callback) {
              deferred.then(
                  function (result) {
                      callback(Promise.NO_ERROR, result);
                  },
                  function (error) {
                      callback(error, Promise.NO_RESULT);
                  }
              );
          }
  
          return deferred.getPromise();
      };
  }