code: def __init__(self, sock=None, map=None):
      if map is None:
          self._map = socket_map
      else:
          self._map = map
  
      self._fileno = None
  
      if sock:
          # Set to nonblocking just to make sure for cases where we
          # get a socket from a blocking source.
          sock.setblocking(False)
          self.set_socket(sock, map)
          self.connected = True
          # The constructor no longer requires that the socket
          # passed be connected.
          try:
              self.addr = sock.getpeername()
          except OSError as err:
              if err.errno in (ENOTCONN, EINVAL):
                  # To handle the case where we got an unconnected
                  # socket.
                  self.connected = False
              else:
                  # The socket is broken in some unknown way, alert
                  # the user and remove it from the map (to prevent
                  # polling of broken sockets).
                  self.del_channel(map)
                  raise
      else:
          self.socket = None
  
imports: import select
  import socket
  import sys
  import time
  import warnings
  import os
  from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, ENOTCONN, ESHUTDOWN, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, errorcode
label_desc: Use image node_id 1 to create a new dispatcher object  with example: obj = dispatcher(sock, map)