def _get_tags(data):
    '''
    Retrieve all the tags for this distro from the yaml
    '''
    ret = {}
    distro = __grains__.get('osfinger')
    for toplist, toplevel in data.get('service', {}).iteritems():
        # service:blacklist
        for audit_dict in toplevel:
            # service:blacklist:0
            for audit_id, audit_data in audit_dict.iteritems():
                # service:blacklist:0:telnet
                tags_dict = audit_data.get('data', {})
                # service:blacklist:0:telnet:data
                tags = tags_dict.get(distro, tags_dict.get('*', []))
                # service:blacklist:0:telnet:data:Debian-8
                if isinstance(tags, dict):
                    # malformed yaml, convert to list of dicts
                    tmp = []
                    for name, tag in tags.iteritems():
                        tmp.append({name: tag})
                    tags = tmp
                for item in tags:
                    for name, tag in item.iteritems():
                        if tag not in ret:
                            ret[tag] = []
                        formatted_data = {'name': name,
                                          'tag': tag,
                                          'module': 'service',
                                          'type': toplist}
                        formatted_data.update(audit_data)
                        formatted_data.pop('data')
                        ret[tag].append(formatted_data)
    return ret
dataset/ETHPy150Open HubbleStack/Nova/hubblestack_nova/service.py/_get_tags/original