def accept(self, lsock, act = None):
     """accept(self, lsock [,act])
     Start asynchronous accept operation on listening socket. 
     act, which defaults to None is asynchronous completion token for this operation. 
     Upon completion, the result dictionary has following keys:
     "type" maps to string  "accept",
     "success" maps to 1 if operation succeeded and 0 otherwise,
     "listen_socket" maps to listening socket (lsock parameter of accept), 
     "accept_socket" maps to socket which is the result of accept op, 
     "act" maps to asynchronous completion token of this operation (act parameter of accept).
     """
     lsock_family = get_sock_family(lsock._sock)
     lsock_type = get_sock_type(lsock._sock)
     lsock_proto = get_sock_proto(lsock._sock)
     asock = socket.socket(lsock_family, lsock_type, lsock_proto)
     return _apoll.accept(self, lsock._sock, asock._sock, lsock, asock, act)
 def connect(self, sock, addr, act = None):
     """connect(self, sock, addr, [, act])
     Start asynchronous connect operation on socket sock.
     If sock is SOCK_STREAM socket, then if it is not bound, then it will be 
     bound to random address (just like synchronous connect does).
     act, which defaults to None represents asynchronous completion token for this operation.
     Upon completion the result dictionary has following keys:
     "type" maps to string "connect",
     "success" maps to 1 if operation succeeded and 0 otherwise,
     "socket" maps to socket which was connected (sock parameter of apoll.connect), 
     "addr" maps to addr object which was passed to this method (addr parameter of apoll.connect)
     "act" maps to asynchronous completion token for this operation (act parameter of apoll.connect).
     """
     if get_sock_type(sock._sock) == socket.SOCK_STREAM:
         try:
             sock.bind(('', 0))
         except socket.error:
             pass
     return _apoll.connect(self, sock._sock, sock, addr, act)