code: def parse_conn_protocol(maddr: Multiaddr) -> int:
      proto_codes = set(proto.code for proto in maddr.protocols())
      proto_cand = proto_codes.intersection(SUPPORT_CONN_PROTOCOLS)
      if len(proto_cand) != 1:
          raise ValueError(
              f"connection protocol should be only one protocol out of {SUPPORTED_PROTOS}"
              f", maddr={maddr}"
          )
      return tuple(proto_cand)[0]
  
file_path: hivemind/hivemind/p2p/p2p_daemon_bindings/control.py
imports: import asyncio
  from contextlib import asynccontextmanager, closing
  from typing import AsyncIterator, Awaitable, Callable, Dict, Iterable, Optional, Sequence, Tuple
  from uuid import UUID, uuid4
  from multiaddr import Multiaddr, protocols
  from hivemind.p2p.p2p_daemon_bindings.datastructures import PeerID, PeerInfo, StreamInfo
  from hivemind.p2p.p2p_daemon_bindings.utils import DispatchFailure, P2PDaemonError, P2PHandlerError, raise_if_failed, read_pbmsg_safe, write_pbmsg
  from hivemind.proto import p2pd_pb2
  from hivemind.utils.logging import get_logger
label_desc: Use image node_id 1 for calling a global function with example usage: parse_conn_protocol(maddr) and returns: tuple