code: def _dict_mapping_to_pb(mapping, proto_type):
      
      converted_pb = getattr(trace_pb2, proto_type)()
      ParseDict(mapping, converted_pb)
      return converted_pb
docs: Convert a dict to protobuf.
  
      Args:
          mapping (dict): A dict that needs to be converted to protobuf.
          proto_type (str): The type of the Protobuf.
  
      Returns:
          An instance of the specified protobuf.