'Write some data to the file.
@param data: The data to write.  Text will be encoded as UTF-8.
@type data: L{bytes} or L{unicode}'

def write(self, data):

    if self.shouldRotate():
        self.flush()
        self.rotate()
    if isinstance(data, unicode):
        data = data.encode('utf8')
    self._file.write(data)
