def dump(ofp, *pb_objs, **kwargs):
mode = '<STR_LIT:wb>'<EOL>if isinstance(ofp, str):<EOL><INDENT>ostream = open(ofp, mode=mode, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>ostream = open(fileobj=ofp, mode=mode, **kwargs)<EOL><DEDENT>with ostream:<EOL><INDENT>ostream.write(*pb_objs)<EOL><DEDENT>
Write to a stream.

    Args:
        ofp (string or file-like object): output stream.
        pb_objs (*protobuf.message.Message): list of protobuf message objects
            to be written.