Returns the group id to a given group name. Returns ``None`` if the group does not exist.

    :param groupname: Group name.
    :type groupname: unicode
    :return: Group id.
    :rtype: int

def get_group_id(groupname):
    """
    Returns the group id to a given group name. Returns ``None`` if the group does not exist.

    :param groupname: Group name.
    :type groupname: unicode
    :return: Group id.
    :rtype: int
    """
    gid = single_line_stdout('id -g {0}'.format(groupname), expected_errors=(1,), shell=False)
    return check_int(gid)