code: def _create_device_array(
      shape, device_type, host_id, local_device_ids=None
  ):
      """Returns ID and device lists that can be used to create a mesh."""
      num_global_devices = config.num_global_devices(device_type)
      global_device_ids = np.arange(num_global_devices).reshape(shape)
      local_device_list = config.local_devices(device_type)
  
      # User can specify local_device_ids or use default list for multi host.
      num_local_devices = len(local_device_list)
      local_device_ids = (
          [
              x + host_id * num_local_devices
              for x in range(num_local_devices)
          ]
          if not local_device_ids
          else local_device_ids
      )
  
      return global_device_ids, local_device_ids, local_device_list
  
imports: import functools
  import time
  from typing import List, Optional, Dict
  import numpy
  from tensorflow.dtensor.python import config
  from tensorflow.dtensor.python import dtensor_device
  from tensorflow.dtensor.python import gen_dtensor_ops
  from tensorflow.dtensor.python import layout
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.tpu import topology
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 1 for calling a global function with example usage: _create_device_array(shape, device_type, host_id, local_device_ids) and returns: global_device_ids,  local_device_ids,  local_device_list