From http://blog.log4d.com/2013/01/python-epoll/