def METHOD_NAME():
  """Return the device codename."""
  serial = environment.get_value('ANDROID_SERIAL')
  devices_output = adb.run_command(['devices', '-l'])
  serial_pattern = r'(^|\s){serial}\s'.format(serial=re.escape(serial))
  serial_regex = re.compile(serial_pattern)
  for line in devices_output.splitlines():
    values = line.strip().split()
    if not serial_regex.search(line):
      continue
    for value in values:
      if not value.startswith('device:'):
        continue
      device_codename = value.split(':')[-1]
      if device_codename:
        return device_codename
  # Unable to get code name.
  return ''