def _platform_name():
    """
    Returns information about the current operating system and version

    :return:
        A unicode string containing the OS name and version
    """

    if sys.platform == 'darwin':
        version = _plat.mac_ver()[0]
        _plat_ver_info = tuple(map(int, version.split('.')))
        if _plat_ver_info < (10, 12):
            name = 'OS X'
        else:
            name = 'macOS'
        return '%s %s' % (name, version)

    elif sys.platform == 'win32':
        _win_ver = sys.getwindowsversion()
        _plat_ver_info = (_win_ver[0], _win_ver[1])
        return 'Windows %s' % _plat.win32_ver()[0]

    elif sys.platform in ['linux', 'linux2']:
        if os.path.exists('/etc/os-release'):
            with open('/etc/os-release', 'r', encoding='utf-8') as f:
                pairs = _parse_env_var_file(f.read())
                if 'NAME' in pairs and 'VERSION_ID' in pairs:
                    return '%s %s' % (pairs['NAME'], pairs['VERSION_ID'])
                    version = pairs['VERSION_ID']
                elif 'PRETTY_NAME' in pairs:
                    return pairs['PRETTY_NAME']
                elif 'NAME' in pairs:
                    return pairs['NAME']
                else:
                    raise ValueError('No suitable version info found in /etc/os-release')
        elif os.path.exists('/etc/lsb-release'):
            with open('/etc/lsb-release', 'r', encoding='utf-8') as f:
                pairs = _parse_env_var_file(f.read())
                if 'DISTRIB_DESCRIPTION' in pairs:
                    return pairs['DISTRIB_DESCRIPTION']
                else:
                    raise ValueError('No suitable version info found in /etc/lsb-release')
        else:
            return 'Linux'

    else:
        return '%s %s' % (_plat.system(), _plat.release())
def _platform_name ( ) : if sys . platform == 'darwin' : version = _plat . mac_ver ( ) [ 0 ] _plat_ver_info = tuple ( map ( int , version . split ( '.' ) ) ) if _plat_ver_info < ( 10 , 12 ) : name = 'OS X' else : name = 'macOS' return '%s %s' % ( name , version ) elif sys . platform == 'win32' : _win_ver = sys . getwindowsversion ( ) _plat_ver_info = ( _win_ver [ 0 ] , _win_ver [ 1 ] ) return 'Windows %s' % _plat . win32_ver ( ) [ 0 ] elif sys . platform in [ 'linux' , 'linux2' ] : if os . path . exists ( '/etc/os-release' ) : with open ( '/etc/os-release' , 'r' , encoding = 'utf-8' ) as f : pairs = _parse_env_var_file ( f . read ( ) ) if 'NAME' in pairs and 'VERSION_ID' in pairs : return '%s %s' % ( pairs [ 'NAME' ] , pairs [ 'VERSION_ID' ] ) version = pairs [ 'VERSION_ID' ] elif 'PRETTY_NAME' in pairs : return pairs [ 'PRETTY_NAME' ] elif 'NAME' in pairs : return pairs [ 'NAME' ] else : raise ValueError ( 'No suitable version info found in /etc/os-release' ) elif os . path . exists ( '/etc/lsb-release' ) : with open ( '/etc/lsb-release' , 'r' , encoding = 'utf-8' ) as f : pairs = _parse_env_var_file ( f . read ( ) ) if 'DISTRIB_DESCRIPTION' in pairs : return pairs [ 'DISTRIB_DESCRIPTION' ] else : raise ValueError ( 'No suitable version info found in /etc/lsb-release' ) else : return 'Linux' else : return '%s %s' % ( _plat . system ( ) , _plat . release ( ) )
Returns information about the current operating system and version

    :return:
        A unicode string containing the OS name and version