function startBackgroundTransaction(name, group, handle) {
  const metric = this.agent.metrics.getOrCreateMetric(
    NAMES.SUPPORTABILITY.API + '/startBackgroundTransaction'
  )
  metric.incrementCallCount()

  if (handle === undefined && typeof group === 'function') {
    handle = group
    group = 'Nodejs'
  }

  if (typeof handle !== 'function') {
    logger.warn('startBackgroundTransaction called with a handle that is not a function')
    return null
  }

  if (!name) {
    logger.warn('startBackgroundTransaction called without a name')
    return handle()
  }

  logger.debug('starting background transaction %s:%s (%s)', name, group, handle && handle.name)

  const tracer = this.agent.tracer
  const shim = this.shim
  const txName = group + '/' + name
  const parentTx = tracer.getTransaction()

  assignCLMSymbol(shim, handle)
  return tracer.transactionNestProxy('bg', function startBackgroundSegment() {
    const context = tracer.getContext()
    const tx = context?.transaction
    const parent = context?.segment

    if (!tx) {
      return handle.apply(this, arguments)
    }

    if (tx === parentTx) {
      logger.debug('not creating nested transaction %s using transaction %s', txName, tx.id)
      return tracer.addSegment(txName, null, parent, true, handle)
    }

    logger.debug(
      'creating background transaction %s:%s (%s) with transaction id: %s',
      name,
      group,
      handle && handle.name,
      tx.id
    )

    tx._partialName = txName
    tx.baseSegment = tracer.createSegment({
      name,
      recorder: recordBackground,
      transaction: tx,
      parent
    })
    const newContext = context.enterSegment({ transaction: tx, segment: tx.baseSegment })
    tx.baseSegment.spanKind = 'server'
    tx.baseSegment.partialName = group
    tx.baseSegment.start()

    const boundHandle = tracer.bindFunction(handle, newContext)
    maybeAddCLMAttributes(handle, tx.baseSegment)
    let returnResult = boundHandle.call(this)
    if (returnResult && shim.isPromise(returnResult)) {
      returnResult = shim.interceptPromise(returnResult, tx.end.bind(tx))
    } else if (!tx.handledExternally) {
      logger.debug('Ending unhandled background transaction immediately.')
      tx.end()
    }
    return returnResult
  })()
}
Creates and starts a background transaction to record work done in
the handle supplied. This transaction will run until the handle
synchronously returns UNLESS:
1. The handle function returns a promise, where the end of the
   transaction will be tied to the end of the promise returned.
2. {@link API#getTransaction} is called in the handle, flagging the
   transaction as externally handled.  In this case the transaction
   will be ended when {@link TransactionHandle#end} is called in the user's code.

@example
const newrelic = require('newrelic')
newrelic.startBackgroundTransaction('Red October', 'Subs', function() {
  const transaction = newrelic.getTransaction()
  setTimeout(function() {
    // do some work
    transaction.end()
  }, 100)
})
@param {string} name
 The name of the transaction. It is used to name and group related
 transactions in APM, so it should be a generic name and not include any
 variable parameters.
@param {string} [group]
 Optional, used for grouping background transactions in APM. For more
 information see:
 https://docs.newrelic.com/docs/apm/applications-menu/monitoring/transactions-page#txn-type-dropdown
@param {Function} handle
 Function that represents the background work.
@memberof API#
@returns {null|*} Returns null if handle is not a function, otherwise the return value of handle