def _write_file(self, filename, data):
        """Write a data item into a file.

        The data object is written to a file using the pickle mechanism.

        :param filename: Output file name
        :type filename: str
        :param data: A Python object that will be pickled
        """

        if self.__compression:
            f = gzip.GzipFile(filename, "wb")
        else:
            f = open(filename, "wb")
        pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
        f.close()
Write a data item into a file.

        The data object is written to a file using the pickle mechanism.

        :param filename: Output file name
        :type filename: str
        :param data: A Python object that will be pickled