function applyContext({ func, context, full, boundThis, args, inContextCB }) {
  const { segment } = context
  // Exit fast for bad arguments.
  if (!this.isFunction(func)) {
    return
  }

  if (!segment) {
    this.logger.trace('No segment to apply to function.')
    return fnApply.call(func, boundThis, args)
  }

  this.logger.trace('Applying segment %s', segment.name)

  /**
   *
   */
  function runInContextCb() {
    if (typeof inContextCB === 'function') {
      inContextCB(segment)
    }

    return fnApply.call(func, this, arguments)
  }

  return this.tracer.bindFunction(runInContextCb, context, full).apply(boundThis, args)
}
Binds a function to the async context manager with the passed in context.

- `applyContext({ func, context , full, boundThis, args, inContextCB })`

@memberof Shim.prototype
@param {object} params to function
@param {Function} params.func The function to execute in given async context.
@param {Context} params.context This context you want to run a function in
@param {boolean} params.full Indicates if the full lifetime of the segment is bound to this function.
@param {*} params.boundThis The `this` argument for the function.
@param {Array.<*>} params.args The arguments to be passed into the function.
@param {Function} [params.inContextCB] The function used to do more instrumentation work. This function is
 guaranteed to be executed with the segment associated with.
@returns {*} Whatever value `func` returned.