def METHOD_NAME(tracer: Tracer):
    with tracer.start_as_current_span("test"):
        span = tracer.start_span("testspan", kind=SpanKind.CONSUMER)
        with tracer.start_as_current_span("testspan2"):
            pass
        with trace.use_span(span, end_on_exit=True):
            with tracer.start_as_current_span("testspan3"):
                pass
    client = tracer.client
    transaction = client.events[constants.TRANSACTION][0]
    # The spans come in out of the normal/intuitive order, since "testspan2" ends first.
    span1 = client.events[constants.SPAN][2]
    span2 = client.events[constants.SPAN][0]
    span3 = client.events[constants.SPAN][1]
    assert span1["transaction_id"] == span1["parent_id"] == transaction["id"]
    assert span1["name"] == "testspan"
    assert span2["transaction_id"] == span2["parent_id"] == transaction["id"]
    assert span2["name"] == "testspan2"
    assert span3["transaction_id"] == transaction["id"]
    assert span3["parent_id"] == span1["id"]
    assert span3["name"] == "testspan3"