code: def address_from_user_args(  # type: ignore[no-untyped-def]
      host=None,
      port=None,
      interface=None,
      protocol=None,
      peer=None,
      security=None,
      default_port=0,
  ) -> str:
      """Get an address to listen on from common user provided arguments"""
  
      if security and security.require_encryption and not protocol:
          protocol = "tls"
  
      if protocol and protocol.endswith("://"):
          protocol, _, _ = protocol.rpartition("://")
  
      if protocol == "inplace":
          if host or port or interface:
              raise ValueError(
                  "Can not specify inproc protocol and host or port or interface"
              )
          else:
              return "inproc://"
  
      if interface:
          if host:
              raise ValueError(
                  "Can not specify both interface and host",
                  interface,
                  host,
              )
          else:
              host = get_ip_interface(interface)
  
      if protocol and host and "://" not in host:
          host = protocol + "://" + host
  
      if host or port:
          addr = uri_from_host_port(host, port, default_port)
      else:
          addr = ""
  
      if protocol:
          addr = protocol + "://" + addr.split("://")[-1]
  
      return addr
  
file_path: distributed/distributed/comm/addressing.py
imports: from __future__ import annotations
  import itertools
  import dask
  from distributed.comm import registry
  from distributed.utils import get_ip_interface
label_desc: Use image node_id 12 for calling a global function with example usage: address_from_user_args(host, port, interface, protocol, peer, security, default_port) and returns: addr, str