code: def test_get_local_address_for(tcp):
      f = get_local_address_for
  
      assert f("tcp://127.0.0.1:80") == "tcp://127.0.0.1"
      assert f("tcp://8.8.8.8:4444") == "tcp://" + get_ip()
      if has_ipv6():
          assert f("tcp://[::1]:123") == "tcp://[::1]"
  
      inproc_arg = "inproc://%s/%d/444" % (get_ip(), os.getpid())
      inproc_res = f(inproc_arg)
      assert inproc_res.startswith("inproc://")
      assert inproc_res != inproc_arg
  
imports: from __future__ import annotations
  import asyncio
  import os
  import sys
  import threading
  from functools import partial
  import pytest
  from tornado import ioloop
  import dask
  from distributed.comm import CommClosedError, connect, get_address_host, get_local_address_for, inproc, listen, parse_address, parse_host_port, resolve_address, unparse_host_port
  from distributed.comm.registry import backends, get_backend
  from distributed.comm.tcp import get_stream_address
  from distributed.compatibility import asyncio_run
  from distributed.config import get_loop_factory
  from distributed.metrics import time
  from distributed.protocol import Serialized, deserialize, serialize, to_serialize
  from distributed.protocol.utils_test import get_host_array
  from distributed.utils import get_ip, get_ipv6, get_mp_context, wait_for
  from distributed.utils_test import gen_test, get_cert, get_client_ssl_context, get_server_ssl_context, has_ipv6, requires_ipv6
label_desc: Use image node_id 10 for calling a global function with example usage: test_get_local_address_for(tcp) without return types