def write(self, identifier, line):
        """write `line` to file specified by `identifier`"""
        filename = self.getFilename(identifier)

        if filename not in self.mFiles:

            if self.maxopen and len(self.mFiles) > self.maxopen:
                for f in self.mFiles.values():
                    f.close()
                self.mFiles = {}

            self.mFiles[filename] = self.openFile(filename, "a")
            if self.mHeader:
                self.mFiles[filename].write(self.mHeader)

        try:
            self.mFiles[filename].write(line)
        except __HOLE__, msg:
            raise ValueError(
                "error while writing to %s: msg=%s" % (filename, msg))
        self.mCounts[filename] += 1
dataset/ETHPy150Open CGATOxford/cgat/CGAT/IOTools.py/FilePool.write