'Private method for adding a descriptor from the event loop.
It takes care of adding it if  new or modifying it if already added
for another state (read -> read/write for example).'

def _add(self, xer, primary, other, selectables, event, antievent):

    fd = xer.fileno()
    if (fd not in primary):
        flags = event
        if (fd in other):
            flags |= antievent
            self._poller.modify(fd, flags)
        else:
            self._poller.register(fd, flags)
        primary.add(fd)
        selectables[fd] = xer
