def METHOD_NAME(port, func, comm_api):
    # create listener receiver
    # write cudf object
    # confirm message is sent correctly
    from distributed.comm.utils import to_frames
    from distributed.protocol import to_serialize
    ucp.init()
    if comm_api == "am":
        register_am_allocators()
    async def f(listener_port):
        # coroutine shows up when the client asks
        # to connect
        async def write(ep):
            import cupy
            cupy.cuda.set_allocator(None)
            print("CREATING CUDA OBJECT IN SERVER...")
            cuda_obj_generator = cloudpickle.loads(func)
            cuda_obj = cuda_obj_generator()
            msg = {"data": to_serialize(cuda_obj)}
            frames = await to_frames(msg, serializers=("cuda", "dask", "pickle"))
            for i in range(ITERATIONS):
                # Send meta data
                if comm_api == "tag":
                    await send(ep, frames)
                else:
                    await am_send(ep, frames)
            print("CONFIRM RECEIPT")
            close_msg = b"shutdown listener"
            if comm_api == "tag":
                msg_size = np.empty(1, dtype=np.uint64)
                await ep.recv(msg_size)
                msg = np.empty(msg_size[0], dtype=np.uint8)
                await ep.recv(msg)
            else:
                msg = await ep.am_recv()
            recv_msg = msg.tobytes()
            assert recv_msg == close_msg
            print("Shutting Down Server...")
            await ep.close()
            lf.close()
        lf = ucp.create_listener(write, port=listener_port)
        try:
            while not lf.closed():
                await asyncio.sleep(0.1)
        except ucp.UCXCloseError:
            pass
    loop = get_event_loop()
    loop.run_until_complete(f(port))