def METHOD_NAME(app_name, tool):
    version = get_version()
    telemetry = Telemetry(tid='G-W5E9RNLD4H',
                          app_name=app_name,
                          app_version=version,
                          backend='ga4')
    telemetry.start_session('md')
    telemetry.send_event('md', 'version', version)
    try:
        yield telemetry
    except SystemExit as e:
        telemetry.send_event('md', f'{tool}_result', 'failure' if e.code else 'success')
        if e.code:
            telemetry.send_event('md', f'{tool}_error_type', type(e))
        raise
    except BaseException as e:
        telemetry.send_event('md', f'{tool}_result', 'exception')
        telemetry.send_event('md', f'{tool}_error_type', type(e))
        raise
    else:
        telemetry.send_event('md', f'{tool}_result', 'success')
    finally:
        telemetry.end_session('md')
        telemetry.force_shutdown(1.0)