code: def get_bandwidth_factor(mesh: DeviceMesh) -> List[float]:
      # generate bandwidth factor for intra-host/inter-host communication pattern
      factors = [1.0] * mesh.ndim
      num_devices_per_host = _mesh_resources.num_devices_per_host(
          mesh.device_type
      )
  
      num_devices = 1
      for mesh_dim in reversed(range(mesh.ndim)):
          num_devices *= mesh.size(mesh_dim)
          if num_devices <= num_devices_per_host:
              # magic number for intra-host communication bandwidth factor
              # TODO: see if we need to tweak this or offer a way for user
              # to specify the bandwidths
              factors[mesh_dim] = 0.2
  
      return factors
  
file_path: pytorch/torch/distributed/_tensor/_collective_utils.py
imports: import logging
  import math
  from typing import List, Optional
  import torch
  import torch.distributed._tensor.placement_types
  from torch.distributed.device_mesh import _mesh_resources, DeviceMesh
  from torch.distributed.distributed_c10d import all_to_all, broadcast, get_global_rank, get_rank, get_world_size, GroupMember, ProcessGroup, scatter, Work
label_desc: Use image node_id 5 for calling a global function with example usage: get_bandwidth_factor(mesh) and returns: factors