human
Complete this python program:
def add_accept_handler(sock, callback, io_loop=None):
assistant
#Here is the Python code you requested.

    """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):
        for i in xrange(_DEFAULT_BACKLOG):
            try:
                (connection, address) = sock.accept()
            except socket.error as e:
                if (errno_from_exception(e) in _ERRNO_WOULDBLOCK):
                    return
                if (errno_from_exception(e) == errno.ECONNABORTED):
                    continue
                raise
            callback(connection, address)
    io_loop.add_handler(sock, accept_handler, IOLoop.READ)