code: function(options, func) {
          // 1 argument has been passed, and it's not a function
          // so just return it
          if (isUndefined(func) && !isFunction(options)) {
              return options;
          }
  
          // options is optional
          if (isFunction(options)) {
              func = options;
              options = undefined;
          }
  
          // At this point, we've passed along 2 arguments, and the second one
          // is not a function either, so we'll just return the second argument.
          if (!isFunction(func)) {
              return func;
          }
  
          // We don't wanna wrap it twice!
          if (func.__opbeat__) {
              return func;
          }
  
          function wrapped() {
              var args = [], i = arguments.length,
                  deep = !options || options && options.deep !== false;
              // Recursively wrap all of a function's arguments that are
              // functions themselves.
  
              while(i--) args[i] = deep ? Opbeat.wrap(options, arguments[i]) : arguments[i];
  
              try {
                  /*jshint -W040*/
                  return func.apply(this, args);
              } catch(e) {
                  Opbeat.captureException(e, options);
                  throw e;
              }
          }
  
          // copy over properties of the old function
          for (var property in func) {
              if (hasKey(func, property)) {
                  wrapped[property] = func[property];
              }
          }
  
          // Signal that this function has been wrapped already
          // for both debugging and to prevent it to being wrapped twice
          wrapped.__opbeat__ = true;
          wrapped.__inner__ = func;
  
          return wrapped;
      }
docs: /*
  Wrap code within a context and returns back a new function to be executed
  
  @param {object} options A specific set of options for this context [optional]
  @param {function} func The function to be wrapped in a new context
  @return {function} The newly wrapped functions with a context