#NEWLINE# def get_gid( group = None ) : #NEWLINE# #INDENT# '\n    Get the gid for a given group name. If no group given,\n    the current egid will be returned. If the group\n    does not exist, None will be returned. On\n    systems which do not support grp or os.getegid\n    it will return None.\n    ' #NEWLINE# if ( grp is None ) : #NEWLINE# #INDENT# result = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( g_struct is None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# result = os . getegid ( ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# result = None #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# g_struct = grp . getgrnam ( group ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# result = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = g_struct . gr_gid #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return result