def _getImplementation(self):
        """
        Pick a method which gives correct results for C{_listOpenFDs} in this
        runtime environment.

        This involves a lot of very platform-specific checks, some of which may
        be relatively expensive.  Therefore the returned method should be saved
        and re-used, rather than always calling this method to determine what it
        is.

        See the implementation for the details of how a method is selected.
        """
        for impl in self._implementations:
            try:
                before = impl()
            except:
                continue
            with self.openfile("/dev/null", "r"):
                after = impl()
            if before != after:
                return impl
        # If no implementation can detect the newly opened file above, then just
        # return the last one.  The last one should therefore always be one
        # which makes a simple static guess which includes all possible open
        # file descriptors, but perhaps also many other values which do not
        # correspond to file descriptors.  For example, the scheme implemented
        # by _fallbackFDImplementation is suitable to be the last entry.
        return impl

        Pick a method which gives correct results for C{_listOpenFDs} in this
        runtime environment.

        This involves a lot of very platform-specific checks, some of which may
        be relatively expensive.  Therefore the returned method should be saved
        and re-used, rather than always calling this method to determine what it
        is.

        See the implementation for the details of how a method is selected.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/process.py