def METHOD_NAME(client):
    def begin_transaction(*args, **kwargs):
        task = kwargs["task"]
        trace_parent = get_trace_parent(task)
        client.begin_transaction("celery", trace_parent=trace_parent)
    def end_transaction(task_id, task, *args, **kwargs):
        name = get_name_from_func(task)
        state = kwargs.get("state", "None")
        if state == states.SUCCESS:
            outcome = constants.OUTCOME.SUCCESS
        elif state in states.EXCEPTION_STATES:
            outcome = constants.OUTCOME.FAILURE
        else:
            outcome = constants.OUTCOME.UNKNOWN
        elasticapm.set_transaction_outcome(outcome, override=False)
        client.end_transaction(name, state)
    dispatch_uid = "elasticapm-tracing-%s"
    # unregister any existing clients
    signals.before_task_publish.disconnect(set_celery_headers, dispatch_uid=dispatch_uid % "before-publish")
    signals.task_prerun.disconnect(begin_transaction, dispatch_uid=dispatch_uid % "prerun")
    signals.task_postrun.disconnect(end_transaction, dispatch_uid=dispatch_uid % "postrun")
    # register for this client
    signals.before_task_publish.connect(set_celery_headers, dispatch_uid=dispatch_uid % "before-publish")
    signals.task_prerun.connect(begin_transaction, dispatch_uid=dispatch_uid % "prerun", weak=False)
    signals.task_postrun.connect(end_transaction, weak=False, dispatch_uid=dispatch_uid % "postrun")
    _register_worker_signals(client)