Return a list of gids in use

def _list_gids():
    '''
    Return a list of gids in use
    '''
    output = __salt__['cmd.run'](
        ['dscacheutil', '-q', 'group'],
        output_loglevel='quiet',
        python_shell=False
    )
    ret = set()
    for line in salt.utils.itertools.split(output, '\n'):
        if line.startswith('gid:'):
            ret.update(line.split()[1:])
    return sorted(ret)