code: def _format_endpoint_query_result(
      result: Dict, filter_ready: bool = True
  ):
      port = os.environ["MARS_K8S_SERVICE_PORT"]
      endpoints = [
          f"{addr['ip']}:{port}"
          for addr in result["subsets"][0]["addresses"] or []
      ]
      if not filter_ready:
          endpoints = [
              f"{addr['ip']}:{port}"
              for addr in result["subsets"][0]["not_ready_addresses"]
              or []
          ]
      return endpoints
  
file_path: mars/mars/deploy/kubernetes/core.py
imports: import asyncio
  import logging
  import os
  from typing import AsyncGenerator, Dict, List, Optional, TypeVar
  from ...services.cluster import WebClusterAPI
  from ...services.cluster.backends import register_cluster_backend, AbstractClusterBackend
  from ...services.cluster.core import NodeRole
  from ..utils import wait_all_supervisors_ready, next_in_thread
  from .config import MarsReplicationConfig
label_desc: Use image node_id 3 for calling the K8SClusterBackend obj's underlying member method code with example usage: obj._format_endpoint_query_result(result, filter_ready) and returns: endpoints