code: def create_circus_socket_from_uri(
      uri: str, *args: t.Any, name: str = "", **kwargs: t.Any
  ) -> CircusSocket:
      from circus.sockets import CircusSocket
  
      from ..uri import uri_to_path
  
      parsed = urlparse(uri)
      if parsed.scheme in ("file", "unix"):
          return CircusSocket(
              name=name,
              path=uri_to_path(uri),
              *args,
              **kwargs,
          )
      elif parsed.scheme == "tcp":
          return CircusSocket(
              name=name,
              host=parsed.hostname,
              port=parsed.port,
              *args,
              **kwargs,
          )
      else:
          raise ValueError(f"Unsupported URI scheme: {parsed.scheme}")
  
imports: from __future__ import annotations
  import typing
  from typing import TYPE_CHECKING
  from urllib.parse import urlparse
label_desc: Use image node_id 1 for calling a global function with example usage: create_circus_socket_from_uri(uri) and returns: CircusSocket, CircusSocket