def write(self, response, prefix, write_file=None):

        ts = datetime.now().strftime('%Y%m%d%M%S')
        out_ts_dir = '{}/{}'.format(CFG.ARCHIVE_DIR, ts[:len('yyyymmdd')])
        out_prefix_dir = '{}/{}'.format(out_ts_dir, prefix)

        # create filename to write to
        if write_file:
            chunks = write_file.split('.')
            # separate the file extension from the file name, default to .txt
            ext = '.{}'.format('.'.join(chunks[1:])) if chunks[1:] else '.txt'
            outfile = '{}/{}-{}{}'.format(out_prefix_dir, chunks[0], ts, ext)
        else:
            outfile = '{}/{}-{}.txt'.format(out_prefix_dir, prefix, ts)

        # create directories if they don't exist
        if not os.path.isdir(CFG.ARCHIVE_DIR):
            os.mkdir(CFG.ARCHIVE_DIR)
        if not os.path.isdir(out_ts_dir):
            os.mkdir(out_ts_dir)
        if not os.path.isdir(out_prefix_dir):
            os.mkdir(out_prefix_dir)

        # if file already exists, append unique digit to the end
        if os.path.exists(outfile):
            count = 1
            orig_outfile = outfile
            outfile = orig_outfile + '.{}'.format(count)
            while os.path.exists(outfile):
                outfile = orig_outfile + '.{}'.format(count)
                count += 1

        with open(outfile, 'w') as f:
            f.write(response)
            print 'posh : {} written to {}'.format(prefix, outfile)
Verifies (file) storage paths.
dataset/ETHPy150Open mossberg/poet/server.py/PoetServer.write--crossover with--dataset/ETHPy150Open ganeti/ganeti/lib/cmdlib/cluster/verify.py/LUClusterVerifyGroup._VerifyStoragePaths