code: def _as_device_str_or_none(device_type):
      # For backwards compatibility only, we support lowercase variants of
      # cpu and gpu but turn them into uppercase here.
      if device_type in ("cpu", "gpu"):
          return device_type.upper()
      return _as_str_or_none(device_type)
  
imports: from tensorflow.python.util.tf_export import tf_export
  from tensorflow.python import pywrap_tfe
label_desc: Use image node_id 3 for calling a global function with example usage: _as_device_str_or_none(device_type) and returns: _as_str_or_none, device_type