def _find_dirs(metadata):

    ret = {}

    for bucket_name, data in six.iteritems(metadata):
        if bucket_name not in ret:
            ret[bucket_name] = set()

        for path in [k['Key'] for k in data]:
            prefix = ''
            for part in path.split('/')[:-1]:
                directory = prefix + part + '/'
                ret[bucket_name].add(directory)
                prefix = directory

    return ret
Merges an existing dict of query string values and updates the values.
dataset/ETHPy150Open saltstack/salt/salt/fileserver/s3fs.py/_find_dirs--crossover with--dataset/ETHPy150Open watsonpy/watson-framework/watson/framework/support/jinja2/filters.py/merge_query_string