code: def _generate_max_text(perfs: List[float]) -> str:
      max_perf = max(perfs)
  
      max_perf_indices = [
          i for i in range(len(perfs)) if perfs[i] == max_perf
      ]
      rank_text = "ranks" if len(max_perf_indices) > 1 else "rank"
      max_perf_indices = _collapse_consecutive_ranks(max_perf_indices)
      max_perf_ranks = f"{rank_text} {','.join(max_perf_indices)}"
  
      return f"{round(max_perf, 3)} ms on {max_perf_ranks}"
  
imports: import logging
  from collections import defaultdict
  from typing import Any, cast, Dict, List, Optional, Tuple, Union
  from torch import nn
  from torchrec.distributed.planner.constants import BIGINT_DTYPE, NUM_POOLINGS
  from torchrec.distributed.planner.shard_estimators import _calculate_shard_io_sizes
  from torchrec.distributed.planner.storage_reservations import FixedPercentageStorageReservation, HeuristicalStorageReservation, InferenceStorageReservation
  from torchrec.distributed.planner.types import ParameterConstraints, Perf, ShardingOption, Stats, Storage, StorageReservation, Topology
  from torchrec.distributed.planner.utils import _find_imbalance_tables, bytes_to_gb, bytes_to_mb, sharder_name
  from torchrec.distributed.types import ModuleSharder, ParameterSharding, ShardingPlan, ShardingType
label_desc: Use image node_id 1 for calling a global function with example usage: _generate_max_text(perfs) and returns: round, str, max_perf_ranks