code: def run_protocol_listener(
      dhtid: DHTID,
      maddr_conn: mp.connection.Connection,
      initial_peers: Sequence[Multiaddr],
  ) -> None:
      loop = asyncio.new_event_loop()
      asyncio.set_event_loop(loop)
  
      p2p = loop.run_until_complete(
          P2P.create(initial_peers=initial_peers)
      )
      visible_maddrs = loop.run_until_complete(p2p.get_visible_maddrs())
  
      protocol = loop.run_until_complete(
          DHTProtocol.create(
              p2p,
              dhtid,
              bucket_size=20,
              depth_modulo=5,
              num_replicas=3,
              wait_timeout=5,
          )
      )
  
      logger.info(
          f"Started peer id={protocol.node_id} visible_maddrs={visible_maddrs}"
      )
  
      for peer_id in maddrs_to_peer_ids(initial_peers):
          loop.run_until_complete(protocol.call_ping(peer_id))
  
      maddr_conn.send((p2p.peer_id, visible_maddrs))
  
      async def shutdown():
          await p2p.shutdown()
          logger.info(
              f"Finished peer id={protocol.node_id} maddrs={visible_maddrs}"
          )
          loop.stop()
  
      loop.add_signal_handler(
          signal.SIGTERM, lambda: loop.create_task(shutdown())
      )
      loop.run_forever()
  
file_path: hivemind/tests/test_dht_protocol.py
imports: import asyncio
  import multiprocessing
  import random
  import signal
  from typing import List, Sequence, Tuple
  import pytest
  from multiaddr import Multiaddr
  import hivemind
  from hivemind import P2P, PeerID, get_dht_time, get_logger
  from hivemind.dht import DHTID
  from hivemind.dht.protocol import DHTProtocol
  from hivemind.dht.storage import DictionaryDHTValue
label_desc: Use image node_id 2 for calling a global function with example usage: run_protocol_listener(dhtid, maddr_conn, initial_peers) without return types