def connectionLost(self, reason):
        """
        Release the inotify file descriptor and do the necessary cleanup
        """
        FileDescriptor.connectionLost(self, reason)
        if self._fd >= 0:
            try:
                os.close(self._fd)
            except OSError as e:
                log.err(e, "Couldn't close INotify file descriptor.")

        Release the inotify file descriptor and do the necessary cleanup
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/inotify.py