def shorten_device_string(long_device_string):
  """Turns long device string into short string like "gpu:0" . """
  start_pos = long_device_string.index("/device:")
  assert start_pos >= 0
  short_device_string = long_device_string[start_pos+len("/device:"):]
  assert short_device_string
  return short_device_string.lower()