def _get_pool_results(*args, **kwargs):
    # TODO: the option "survey.sort=" would be preferred for namespace
    # separation but the kwargs parser for the salt-run command seems to
    # improperly pass the options containing a "." in them for later modules to
    # process. The "_" is used here instead.

    import hashlib

    tgt = args[0]
    cmd = args[1]
    ret = {}

    sort = kwargs.pop('survey_sort', 'down')
    direction = sort != 'up'

    expr_form = kwargs.pop('expr_form', 'compound')
    if expr_form not in ['compound', 'pcre']:
        expr_form = 'compound'

    kwargs_passthru = dict((k, kwargs[k]) for k in kwargs.iterkeys() if not k.startswith('_'))

    client = salt.client.get_local_client(__opts__['conf_file'])
    try:
        minions = client.cmd(tgt, cmd, args[2:], timeout=__opts__['timeout'], expr_form=expr_form, kwarg=kwargs_passthru)
    except SaltClientError as client_error:
        print(client_error)
        return ret

    # hash minion return values as a string
    for minion in sorted(minions):
        digest = hashlib.sha256(str(minions[minion])).hexdigest()
        if digest not in ret:
            ret[digest] = {}
            ret[digest]['pool'] = []
            ret[digest]['result'] = str(minions[minion])

        ret[digest]['pool'].append(minion)

    sorted_ret = []
    for k in sorted(ret, key=lambda k: len(ret[k]['pool']), reverse=direction):
        # return aggregated results, sorted by size of the hash pool

        sorted_ret.append(ret[k])

    return sorted_ret
A helper function which returns a dictionary of minion pools along with
dataset/ETHPy150Open saltstack/salt/salt/runners/survey.py/_get_pool_results