def close(self):
        # TODO: add a unit test that this try-except logic is necessary.
        try:
            close = self.file.close
        except __HOLE__:
            if self.file is not None:
                raise
            # Otherwise, the file was never opened in the first place.
        else:
            close()
dataset/ETHPy150Open cjerdonek/open-rcv/openrcv/streams.py/_ReadWriteFileBase.close