def _get_subjects_and_metrics_by_tag(data_model, reports, tag: str):
    'Return all subjects and metrics that have the tag.'
    subjects = {}
    for report in reports:
        for (subject_uuid, subject) in list(report.get('subjects', {}).items()):
            for (metric_uuid, metric) in list(subject.get('metrics', {}).items()):
                if (tag not in metric.get('tags', [])):
                    del subject['metrics'][metric_uuid]
            if subject.get('metrics', {}):
                subject_name = (subject.get('name') or data_model['subjects'][subject['type']]['name'])
                subject['name'] = ((report['title'] + ' / ') + subject_name)
                subjects[subject_uuid] = subject
    return subjects
Return all subjects and metrics that have the tag.
def _get_subjects_and_metrics_by_tag(data_model, reports, tag: str):
    
    subjects = {}
    for report in reports:
        for (subject_uuid, subject) in list(report.get('subjects', {}).items()):
            for (metric_uuid, metric) in list(subject.get('metrics', {}).items()):
                if (tag not in metric.get('tags', [])):
                    del subject['metrics'][metric_uuid]
            if subject.get('metrics', {}):
                subject_name = (subject.get('name') or data_model['subjects'][subject['type']]['name'])
                subject['name'] = ((report['title'] + ' / ') + subject_name)
                subjects[subject_uuid] = subject
    return subjects