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