code: def _convert_proto_map_to_dict(
      proto_map: Any,
  ) -> Dict[str, Dict[str, Any]]:
      """Converts a metric map (metrics in MetricsForSlice protobuf) into a dict.
  
      Args:
        proto_map: A protocol buffer MessageMap that has behaviors like dict. The
          keys are strings while the values are protocol buffers. However, it is not
          a protobuf message and cannot be passed into json_format.MessageToDict
          directly. Instead, we must iterate over its values.
  
      Returns:
        A dict representing the proto_map. For example:
        Assume myProto contains
        {
          metrics: {
            key: 'double'
            value: {
              double_value: {
                value: 1.0
              }
            }
          }
          metrics: {
            key: 'bounded'
            value: {
              bounded_value: {
                lower_bound: {
                  double_value: {
                    value: 0.8
                  }
                }
                upper_bound: {
                  double_value: {
                    value: 0.9
                  }
                }
                value: {
                  double_value: {
                    value: 0.86
                  }
                }
              }
            }
          }
        }
  
        The output of _convert_proto_map_to_dict(myProto.metrics) would be
  
        {
          'double': {
            'doubleValue': 1.0,
          },
          'bounded': {
            'boundedValue': {
              'lowerBound': 0.8,
              'upperBound': 0.9,
              'value': 0.86,
            },
          },
        }
  
        Note that field names are converted to lowerCamelCase and the field value in
        google.protobuf.DoubleValue is collapsed automatically.
      """
      return {
          k: json_format.MessageToDict(proto_map[k]) for k in proto_map
      }
  
imports: import json
  import os
  from typing import Any, Dict, List, Optional, Tuple, Union
  from absl import logging
  from tensorflow_model_analysis.metrics import example_count
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import weighted_example_count
  from tensorflow_model_analysis.post_export_metrics import metric_keys
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.proto import metrics_for_slice_pb2
  from tensorflow_model_analysis.slicer import slicer_lib
  from tensorflow_model_analysis.view import view_types
  from google.protobuf import json_format
label_desc: Use image node_id 8 for calling a global function with example usage: _convert_proto_map_to_dict(proto_map) and returns: unknown