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.

def _dict_mapping_to_pb(mapping, proto_type):
    """
    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.
    """
    converted_pb = getattr(trace_pb2, proto_type)()
    ParseDict(mapping, converted_pb)
    return converted_pb