code: def connect(uri: URI = LOCAL_HOST) -> InfinityConnection:
      if isinstance(uri, NetworkAddress) and (
          uri.port == 9090 or uri.port == 23817 or uri.port == 9070
      ):
          return RemoteThriftInfinityConnection(uri)
      else:
          raise Exception(f"unknown uri: {uri}")
  
imports: import importlib.metadata
  from infinity.common import URI, NetworkAddress, LOCAL_HOST
  from infinity.infinity import InfinityConnection
  from infinity.remote_thrift.infinity import RemoteThriftInfinityConnection
label_desc: Use image node_id 1 for calling a global function with example usage: connect(uri) and returns: RemoteThriftInfinityConnection