'write text data into path using the specified encoding.
If ensure is True create missing parent directories.'

def write_text(self, data, encoding, ensure=False):

    if ensure:
        self.dirpath().ensure(dir=1)
    with self.open('w', encoding=encoding) as f:
        f.write(data)
