class_docstr: This class is a drop-in replacement for gRPC default serializer.
  It replaces default serializer to make sure the message sending interface is convenient.
  It can handle sending single messages or a list of messages. It also returns a list of messages.
  Effectively this is hiding MessageListProto from the consumer
docstr: # noqa: DAR101
  # noqa: DAR102
  # noqa: DAR201
docstr_tok: ["#","noqa",":","DAR101","#","noqa",":","DAR102","#","noqa",":","DAR201"]
code: def SerializeToString(x: "Union[List[DataRequest], DataRequest]"):
      """
      # noqa: DAR101
      # noqa: DAR102
      # noqa: DAR201
      """
      protos = []
      if not isinstance(x, Iterable):
          protos.append(x.proto_with_data)
      else:
          protos = [r.proto_with_data for r in x]
  
      return jina_pb2.DataRequestListProto(
          requests=protos
      ).SerializeToString()
  
imports: import os
  from typing import Iterable, List, Union
  from jina.proto import jina_pb2
  from jina.types.request.data import DataRequest, SingleDocumentRequest
label_desc: Use image node_id 1 for calling the DataRequestListProto obj's underlying member method code with example usage: obj.SerializeToString(x) and returns: jina_pb2