def METHOD_NAME():
    def QueryPerf(query_specs):
        result = []
        for query_spec in query_specs:
            for entity_metric in PERF_ENTITY_METRICS:
                if query_spec.entity == entity_metric.entity:
                    value = []
                    for metric_id in query_spec.metricId:
                        for metric_value in entity_metric.value:
                            if metric_id.counterId == metric_value.id.counterId:
                                value.append(metric_value)
                    result.append(
                        vim.PerformanceManager.EntityMetric(
                            entity=entity_metric.entity,
                            value=value,
                        )
                    )
        return result
    yield QueryPerf