function bindCallbackSegment(spec, args, cbIdx, parentSegment) {
  if (!args) {
    return
  }

  if (this.isNumber(cbIdx)) {
    const normalizedCBIdx = normalizeIndex(args.length, cbIdx)
    if (normalizedCBIdx === null) {
      // Bad index.
      this.logger.debug(
        'Invalid index %d for args of length %d, not binding callback segment',
        cbIdx,
        args.length
      )
      return
    }
    cbIdx = normalizedCBIdx
  }

  // Make sure cb is function before wrapping
  if (this.isFunction(args[cbIdx])) {
    wrapCallback({ shim: this, args, cbIdx, parentSegment, spec })
  }
}
Replaces the callback in an arguments array with one that has been bound to
the given segment.

- `bindCallbackSegment(spec, args, cbIdx [, segment])`
- `bindCallbackSegment(spec, obj, property [, segment])`

@memberof Shim.prototype
@param {Spec} spec spec to original wrapped function, used to call after method with arguments passed to callback
@param {Array | object} args
 The arguments array to pull the cb from.
@param {number|string} cbIdx
 The index of the callback.
@param {TraceSegment} [parentSegment]
 The segment to use as the callback segment's parent. Defaults to the
 currently active segment.
@see Shim#bindSegment