def close(self, fd):
        """
        Discard the in-memory buffer and other in-memory state for the given
        file descriptor.

        @see: L{os.close}
        """
        try:
            del self._openFiles[fd]
        except KeyError:
            raise OSError(EBADF, "Bad file descriptor")

        Discard the in-memory buffer and other in-memory state for the given
        file descriptor.

        @see: L{os.close}
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/pair/testing.py