def METHOD_NAME():
    while True:
        try:
            sock, (other_host, other_port) = listener.accept()
        except (OSError, socket.error):
            # Listener socket has been closed.
            break
        log.info(
            "Accepted incoming {0} connection from {1}:{2}.",
            name,
            other_host,
            other_port,
        )
        handler(sock)