'Add the given L{FileDescriptor} for monitoring either for reading or
writing. If the file is already monitored for the other operation, we
delete the previous registration and re-register it for both reading
and writing.'

def _add(self, source, primary, other, primaryFlag, otherFlag):

    if (source in primary):
        return
    flags = primaryFlag
    if (source in other):
        self._source_remove(self._sources[source])
        flags |= otherFlag
    self._sources[source] = self.input_add(source, flags, self._ioEventCallback)
    primary.add(source)
