code: def maybe_get_device_name(device_name):
      # TODO(cheshire): This is a hack to get the current "preferred" device,
      # there is no current API to get it otherwise.
      if device_name is None:
          device_name = random_ops.random_normal([]).device
      return device_name
  
file_path: tensorflow/tensorflow/python/eager/polymorphic_function/compiler_ir.py
imports: from typing import List, Optional
  import warnings
  from tensorflow.core.function import trace_type
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.ops import random_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 1 for calling a global function with example usage: maybe_get_device_name(device_name) and returns: device_name