code: def num_local_devices(device_type: str) -> int:
      """Returns the number of devices of device_type configured on this client."""
  
      # Reads from config because CPU and GPU can use logical devices.
      if device_type.upper() in ["CPU", "GPU"]:
          context_config = context.get_config()
          return context_config.device_count[device_type.upper()]
  
      return len(tf_config.list_physical_devices(device_type))
  
imports: import os
  from typing import List, Optional, Union
  from tensorflow.python.eager import context
  from tensorflow.python.framework import config
  from tensorflow.python.framework import device
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling a global function with example usage: num_local_devices(device_type) and returns: len, context_config