code: def add_accept_handler(sock, callback, io_loop=None):
      """Adds an `.IOLoop` event handler to accept new connections on ``sock``.
  
      When a connection is accepted, ``callback(connection, address)`` will
      be run (``connection`` is a socket object, and ``address`` is the
      address of the other end of the connection).  Note that this signature
      is different from the ``callback(fd, events)`` signature used for
      `.IOLoop` handlers.
  
      .. versionchanged:: 4.1
         The ``io_loop`` argument is deprecated.
      """
      if io_loop is None:
          io_loop = IOLoop.current()
  
      def accept_handler(fd, events):
          # More connections may come in while we're handling callbacks;
          # to prevent starvation of other tasks we must limit the number
          # of connections we accept at a time.  Ideally we would accept
          # up to the number of connections that were waiting when we
          # entered this method, but this information is not available
          # (and rearranging this method to call accept() as many times
          # as possible before running any callbacks would have adverse
          # effects on load balancing in multiprocess configurations).
          # Instead, we use the (default) listen backlog as a rough
          # heuristic for the number of connections we can reasonably
          # accept at once.
          for i in xrange(_DEFAULT_BACKLOG):
              try:
                  connection, address = sock.accept()
              except socket.error as e:
                  # _ERRNO_WOULDBLOCK indicate we have accepted every
                  # connection that is available.
                  if errno_from_exception(e) in _ERRNO_WOULDBLOCK:
                      return
                  # ECONNABORTED indicates that there was a connection
                  # but it was closed while still in the accept queue.
                  # (observed on FreeBSD).
                  if errno_from_exception(e) == errno.ECONNABORTED:
                      continue
                  raise
              set_close_exec(connection.fileno())
              callback(connection, address)
  
      io_loop.add_handler(sock, accept_handler, IOLoop.READ)
  
imports: from __future__ import absolute_import, division, print_function
  import errno
  import os
  import sys
  import socket
  import stat
  from tornado.concurrent import dummy_executor, run_on_executor
  from tornado.ioloop import IOLoop
  from tornado.platform.auto import set_close_exec
  from tornado.util import PY3, Configurable, errno_from_exception
label_desc: Use image node_id 2 for calling a global function with example usage: add_accept_handler(sock, callback, io_loop) without return types