class_docstr: A formatter to format the ClusterStatus into a string.
  
  TODO(rickyx): We right now parse the ClusterStatus to the legacy format
  by using the `format_info_string`.
  In the future, we should refactor the `format_info_string` to directly format
  the ClusterStatus into a string as we migrate eventually away from v1.
class_docstr_tok: ["A","formatter","to","format","the","ClusterStatus","into","a","string",".","TODO","(","rickyx",")",":","We","right","now","parse","the","ClusterStatus","to","the","legacy","format","by","using","the","`","format_info_string","`",".","In","the","future",",","we","should","refactor","the","`","format_info_string","`","to","directly","format","the","ClusterStatus","into","a","string","as","we","migrate","eventually","away","from","v1","."]
code: def _parse_lm_summary(cls, data: ClusterStatus) -> LoadMetricsSummary:
      usage = {
          u.resource_name: (u.used, u.total)
          for u in data.cluster_resource_usage
      }
      resource_demands = []
      for demand in data.resource_demands.ray_task_actor_demand:
          for bundle_by_count in demand.bundles_by_count:
              resource_demands.append(
                  (bundle_by_count.bundle, bundle_by_count.count)
              )
  
      pg_demand = []
      pg_demand_strs = []
      pg_demand_str_to_demand = {}
      for pg_demand in data.resource_demands.placement_group_demand:
          s = pg_demand.strategy + "|" + pg_demand.state
          pg_demand_strs.append(s)
          pg_demand_str_to_demand[s] = pg_demand
  
      pg_freqs = Counter(pg_demand_strs)
      pg_demand = [
          (
              {
                  "strategy": pg_demand_str_to_demand[pg_str].strategy,
                  "bundles": [
                      (bundle_count.bundle, bundle_count.count)
                      for bundle_count in pg_demand_str_to_demand[
                          pg_str
                      ].bundles_by_count
                  ],
              },
              freq,
          )
          for pg_str, freq in pg_freqs.items()
      ]
  
      request_demand = [
          (bc.bundle, bc.count)
          for constraint_demand in data.resource_demands.cluster_constraint_demand
          for bc in constraint_demand.bundles_by_count
      ]
  
      usage_by_node = {}
      node_type_mapping = {}
      idle_time_map = {}
      for node in chain(data.active_nodes, data.idle_nodes):
          # TODO(rickyx): we should actually add node type info here.
          # TODO(rickyx): we could also show node idle time.
          usage_by_node[node.node_id] = {
              u.resource_name: (u.used, u.total)
              for u in node.resource_usage.usage
          }
          node_type_mapping[node.node_id] = node.ray_node_type_name
          idle_time_map[node.node_id] = node.resource_usage.idle_time_ms
  
      return LoadMetricsSummary(
          usage=usage,
          resource_demand=resource_demands,
          pg_demand=pg_demand,
          request_demand=request_demand,
          node_types=None,  # NOTE: This is not needed in ray status.
          usage_by_node=usage_by_node,
          node_type_mapping=node_type_mapping,
          idle_time_map=idle_time_map,
      )
  
imports: from collections import Counter, defaultdict
  from copy import deepcopy
  from datetime import datetime
  from itertools import chain
  from typing import Any, Dict, List, Tuple
  import ray
  from ray._private.ray_constants import AUTOSCALER_NAMESPACE, AUTOSCALER_V2_ENABLED_KEY
  from ray._private.utils import binary_to_hex
  from ray.autoscaler._private.autoscaler import AutoscalerSummary
  from ray.autoscaler._private.node_provider_availability_tracker import NodeAvailabilityRecord, NodeAvailabilitySummary, UnavailableNodeInformation
  from ray.autoscaler._private.util import LoadMetricsSummary, format_info_string
  from ray.autoscaler.v2.schema import NODE_DEATH_CAUSE_RAYLET_DIED, ClusterConstraintDemand, ClusterStatus, LaunchRequest, NodeInfo, NodeUsage, PlacementGroupResourceDemand, RayTaskActorDemand, ResourceDemand, ResourceDemandSummary, ResourceRequestByCount, ResourceUsage, Stats
  from ray.core.generated.autoscaler_pb2 import AutoscalingState, ClusterResourceState, GetClusterStatusReply, NodeState, NodeStatus, ResourceRequest
  from ray.core.generated.autoscaler_pb2 import ResourceRequestByCount
  from ray.core.generated.instance_manager_pb2 import Instance
  from ray.experimental.internal_kv import _internal_kv_get, _internal_kv_initialized
label_desc: Use image node_id 3 for calling the ClusterStatusFormatter obj's underlying member method code with example usage: obj._parse_lm_summary(cls, data) and returns: LoadMetricsSummary