def _get_systemd_os_release_var(varname, filepath='/etc/os-release'):
 var_string = (varname + '=')
 if (not os.path.isfile(filepath)):
  return ''
 with open(filepath, 'r') as fh:
  contents = fh.readlines()
 for line in contents:
  if line.strip().startswith(var_string):
   return _normalize_string(line.strip()[len(var_string):])
 return ''

def _get_systemd_os_release_var ( varname , filepath = '/etc/os-release' ) : var_string = ( varname + '=' ) if ( not os . path . isfile ( filepath ) ) : return '' with open ( filepath , 'r' ) as fh : contents = fh . readlines ( ) for line in contents : if line . strip ( ) . startswith ( var_string ) : return _normalize_string ( line . strip ( ) [ len ( var_string ) : ] ) return ''
get single value from systemd /etc/os-release .