def write_file(filecontents, filename):
    """ writes a string of data to disk """

    if not os.path.exists(os.path.dirname(filename)):
        os.makedirs(os.path.dirname(filename))

    logger.debug("Writing file '%s' to disk" % filename)

    try:
        with open(filename, "w") as fh:
            fh.write(filecontents)
    except __HOLE__:
        logger.error("Unable to write file '%s'" % filename)

    return True
dataset/ETHPy150Open jesseward/discogstagger/discogstagger/taggerutils.py/write_file