def epoll_poller(timeout=<NUM_LIT:0.0>, map=None):
if map is None:<EOL><INDENT>map = asyncore.socket_map<EOL><DEDENT>pollster = select.epoll()<EOL>if map:<EOL><INDENT>for fd, obj in iteritems(map):<EOL><INDENT>flags = <NUM_LIT:0><EOL>if obj.readable():<EOL><INDENT>flags |= select.POLLIN | select.POLLPRI<EOL><DEDENT>if obj.writable():<EOL><INDENT>flags |= select.POLLOUT<EOL><DEDENT>if flags:<EOL><INDENT>flags |= select.POLLERR | select.POLLHUP | select.POLLNVAL<EOL>pollster.register(fd, flags)<EOL><DEDENT><DEDENT>try:<EOL><INDENT>r = pollster.poll(timeout)<EOL><DEDENT>except select.error as err:<EOL><INDENT>if err.args[<NUM_LIT:0>] != EINTR:<EOL><INDENT>raise<EOL><DEDENT>r = []<EOL><DEDENT>for fd, flags in r:<EOL><INDENT>obj = map.get(fd)<EOL>if obj is None:<EOL><INDENT>continue<EOL><DEDENT>asyncore.readwrite(obj, flags)<EOL><DEDENT><DEDENT>
A poller which uses epoll(), supported on Linux 2.5.44 and newer

Borrowed from here:
https://github.com/m13253/python-asyncore-epoll/blob/master/asyncore_epoll.py#L200