<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def listener(self, acceptor, wrapper):
 """ Listens for new connections to the manager's endpoint. Once a new connection is received, a TCPTendril object is generated for it and it is passed to the acceptor, which must initialize the state of the connection. If no acceptor is given, no new connections can be initialized. :param acceptor: If given, specifies a callable that will be called with each newly received TCPTendril; that callable is responsible for initial acceptance of the connection and for setting up the initial state of the connection. If not given, no new connections will be accepted by the TCPTendrilManager. :param wrapper: A callable taking, as its first argument, a socket.socket object. The callable must return a valid proxy for the socket.socket object, which will subsequently be used to communicate on the connection. """


        # If we have no acceptor, there's nothing for us to do here
        if not acceptor:
            # Not listening on anything
            self.local_addr = None

            # Just sleep in a loop
            while True:
                gevent.sleep(600)
            return  # Pragma: nocover

        # OK, set up the socket
        sock = socket.socket(self.addr_family, socket.SOCK_STREAM)

        with utils.SocketCloser(sock):
            # Set up SO_REUSEADDR
            sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

            # Bind to our endpoint
            sock.bind(self.endpoint)

            # Get the assigned port number
            self.local_addr = sock.getsockname()

            # Call any wrappers
            if wrapper:
                sock = wrapper(sock)

            # Initiate listening
            sock.listen(self.backlog)

        # OK, now go into an accept loop with an error threshold of 10
        closer = utils.SocketCloser(sock, 10,
                                    ignore=[application.RejectConnection])
        while True:
            with closer:
                cli, addr = sock.accept()

                # OK, the connection has been accepted; construct a
                # Tendril for it
                tend = TCPTendril(self, cli, addr)

                # Set up the application
                with utils.SocketCloser(cli):
                    tend.application = acceptor(tend)

                    # Make sure we track the new tendril, but only if
                    # the acceptor doesn't throw any exceptions
                    self._track_tendril(tend)

                    # Start the tendril
                    tend._start()