class_docstr: The ZMQ socket object
  
  To create a Socket, first create a Context::
  
      ctx = zmq.Context.instance()
  
  then call ``ctx.socket(socket_type)``::
  
      s = ctx.socket(zmq.ROUTER)
class_docstr_tok: ["The","ZMQ","socket","object","To","create","a","Socket",",","first","create","a","Context",":",":","ctx","=","zmq.Context.instance","(",")","then","call","``","ctx.socket","(","socket_type",")","``",":",":","s","=","ctx.socket","(","zmq.ROUTER",")"]
docstr: Send a message with a custom serialization function.
  
  .. versionadded:: 17
  
  Parameters
  ----------
  msg : The message to be sent. Can be any object serializable by `serialize`.
  serialize : callable
      The serialization function to use.
      serialize(msg) should return an iterable of sendable message frames
      (e.g. bytes objects), which will be passed to send_multipart.
  flags : int, optional
      Any valid flags for :func:`Socket.send`.
  copy : bool, optional
      Whether to copy the frames.
docstr_tok: ["Send","a","message","with","a","custom","serialization","function",".","..","versionadded",":",":","17","Parameters","--","--","--","--","--","msg",":","The","message","to","be","sent",".","Can","be","any","object","serializable","by","`","serialize","`",".","serialize",":","callable","The","serialization","function","to","use",".","serialize","(","msg",")","should","return","an","iterable","of","sendable","message","frames","(","e.g",".","bytes","objects",")",",","which","will","be","passed","to","send_multipart",".","flags",":","int",",","optional","Any","valid","flags","for",":","func",":","`","Socket.send","`",".","copy",":","bool",",","optional","Whether","to","copy","the","frames","."]
code: def send_serialized(
      self, msg, serialize, flags=0, copy=True, **kwargs
  ):
      """Send a message with a custom serialization function.
  
      .. versionadded:: 17
  
      Parameters
      ----------
      msg : The message to be sent. Can be any object serializable by `serialize`.
      serialize : callable
          The serialization function to use.
          serialize(msg) should return an iterable of sendable message frames
          (e.g. bytes objects), which will be passed to send_multipart.
      flags : int, optional
          Any valid flags for :func:`Socket.send`.
      copy : bool, optional
          Whether to copy the frames.
  
      """
      frames = serialize(msg)
      return self.send_multipart(
          frames, flags=flags, copy=copy, **kwargs
      )
  
imports: import errno
  import random
  import sys
  import warnings
  import zmq
  from zmq.backend import Socket
  from .poll import Poller
  from .None import constants
  from .attrsettr import AttributeSetter
  from zmq.error import ZMQError, ZMQBindError
  from zmq.utils import jsonapi
  from zmq.utils.strtypes import bytes, unicode, basestring
  from .constants import SNDMORE, ENOTSUP, POLLIN, int64_sockopt_names, int_sockopt_names, bytes_sockopt_names, fd_sockopt_names
label_desc: Use image node_id 23 for calling the Socket obj's underlying member method code with example usage: obj.send_serialized(msg, serialize, flags, copy) and returns: self