def GetOSVersionName(self):
    # First try os-release(5).
    for path in ('/etc/os-release', '/usr/lib/os-release'):
      os_release = self._ReadReleaseFile(path)
      if os_release:
        codename = os_release.get('ID', 'linux')
        version = _GetOSVersion(os_release.get('VERSION_ID'))
        return os_version.OSVersion(codename, version)

    # Use lsb-release as a fallback.
    lsb_release = self._ReadReleaseFile('/etc/lsb-release')
    if lsb_release:
      codename = lsb_release.get('DISTRIB_CODENAME')
      version = _GetOSVersion(lsb_release.get('DISTRIB_RELEASE'))
      return os_version.OSVersion(codename, version)

    raise NotImplementedError('Unknown Linux OS version')
    def GetOSVersionName(self):
        if not os.path.exists('/etc/lsb-release'):
            raise NotImplementedError('Unknown Linux OS version')

        codename = None
        version = None
        for line in self.GetFileContents('/etc/lsb-release').splitlines():
            key, _, value = line.partition('=')
            if key == 'DISTRIB_CODENAME':
                codename = value.strip()
            elif key == 'DISTRIB_RELEASE':
                try:
                    version = float(value)
                except ValueError:
                    version = 0
            if codename and version:
                break
        return os_version.OSVersion(codename, version)