def listen(self, address, backlog=1024, slave=True):
        """
        Begin listening for connections made to the channel.

        The given ``address`` is resolved, the channel is bound to the
        address and then begins listening for connections. Once the
        channel has begun listening,
        :meth:`~pants.server.Server.on_listen` will be called.

        Addresses can be represented in a number of different ways. A
        single string is treated as a UNIX address. A single integer is
        treated as a port and converted to a 2-tuple of the form
        ``('', port)``. A 2-tuple is treated as an IPv4 address and a
        4-tuple is treated as an IPv6 address. See the :mod:`socket`
        documentation for further information on socket addresses.

        If no socket exists on the channel, one will be created with a
        socket family appropriate for the given address.

        An error will occur if the given address is not of a valid
        format or of an inappropriate format for the socket (e.g. if an
        IP address is given to a UNIX socket).

        Calling :meth:`listen()` on a closed channel or a channel that
        is already listening will raise a :exc:`RuntimeError`.

        Returns the channel.

        ===============  ================================================
        Arguments        Description
        ===============  ================================================
        address          The local address to listen for connections on.
        backlog          *Optional.* The maximum size of the
                         connection queue.
        slave            *Optional.* If True, this will cause a
                         Server listening on IPv6 INADDR_ANY to
                         create a slave Server that listens on the
                         IPv4 INADDR_ANY.
        ===============  ================================================
        """
        if self.listening:
            raise RuntimeError("listen() called on active %r." % self)

        if self._closed:
            raise RuntimeError("listen() called on closed %r." % self)

        address, family, resolved = self._format_address(address)
        if not family:
            raise ValueError("Unable to determine address family from "
                             "address: %s" % repr(address))

        self._do_listen(address, family, backlog, slave)

        return self
dataset/ETHPy150Open ecdavis/pants/pants/server.py/Server.listen/original