def _linux_os_release():
 pretty_name = ''
 ashtray = {}
 keys = ['NAME', 'VERSION_ID']
 try:
  with open(os.path.join('/etc', 'os-release')) as f:
   for line in f:
    for key in keys:
     if line.startswith(key):
      ashtray[key] = re.sub('^"|"$', '', line.strip().split('=')[1])
 except (OSError, IOError):
  return pretty_name
 if ashtray:
  if ('NAME' in ashtray):
   pretty_name = ashtray['NAME']
  if ('VERSION_ID' in ashtray):
   pretty_name += ' {}'.format(ashtray['VERSION_ID'])
 return pretty_name

def _linux_os_release ( ) : pretty_name = '' ashtray = { } keys = [ 'NAME' , 'VERSION_ID' ] try : with open ( os . path . join ( '/etc' , 'os-release' ) ) as f : for line in f : for key in keys : if line . startswith ( key ) : ashtray [ key ] = re . sub ( '^"|"$' , '' , line . strip ( ) . split ( '=' ) [ 1 ] ) except ( OSError , IOError ) : return pretty_name if ashtray : if ( 'NAME' in ashtray ) : pretty_name = ashtray [ 'NAME' ] if ( 'VERSION_ID' in ashtray ) : pretty_name += ' {}' . format ( ashtray [ 'VERSION_ID' ] ) return pretty_name
try to determine the name of a linux distribution .