def METHOD_NAME(folder, filename, data):
    """
    Writes a file to disk
    """
    path = os.path.join(folder, filename)
    if not os.path.exists(folder):
        msg = "{} cannot be written. {} does not exist".format(filename, folder)
        log.error(msg)
        raise AttributeError(str(msg))
    with salt.utils.files.fopen(path, "w") as fp_:
        fp_.write(salt.utils.stringutils.to_str(data))
    return 0