function createSegment(name, recorder, parent) {
  let opts = {}
  if (this.isString(name)) {
    // createSegment(name [, recorder] [, parent])
    opts.name = name

    // if the recorder arg is not used, it can either be omitted or null
    if (this.isFunction(recorder) || this.isNull(recorder)) {
      // createSegment(name, recorder [, parent])
      opts.recorder = recorder
    } else {
      // createSegment(name [, parent])
      parent = recorder
    }
  } else {
    // createSegment(opts)
    opts = name
    parent = opts.parent
  }

  const transaction = this.tracer.getTransaction()
  parent = parent || this.getActiveSegment()
  const spec = new specs.SegmentSpec(opts)
  return _rawCreateSegment({ shim: this, spec, parent, transaction })
}
Creates a new segment.

- `createSegment(opts)`
- `createSegment(name [, recorder] [, parent])`

@memberof Shim.prototype
@param {string} name
 The name to give the new segment.
@param {?Function} [recorder]
 Optional. A function which will record the segment as a metric. Default is
 to not record the segment.
@param {TraceSegment} [parent]
 Optional. The segment to use as the parent. Default is to use the currently
 active segment.
@returns {?TraceSegment} A new trace segment if a transaction is active, else
 `null` is returned.