def _remove(self, xer, primary, other, selectables, event, antievent):
        """
        Private method for removing a descriptor from the event loop.

        It does the inverse job of _add, and also add a check in case of the fd
        has gone away.
        """
        fd = xer.fileno()
        if fd == -1:
            for fd, fdes in selectables.items():
                if xer is fdes:
                    break
            else:
                return
        if fd in primary:
            if fd in other:
                flags = antievent
                # See comment above modify call in _add.
                self._poller.modify(fd, flags)
            else:
                del selectables[fd]
                # See comment above _control call in _add.
                self._poller.unregister(fd)
            primary.remove(fd)

        Private method for removing a descriptor from the event loop.

        It does the inverse job of _add, and also add a check in case of the fd
        has gone away.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/epollreactor.py