import tempfile


def write_tmpacl(aclobj, suffix='_tmpacl'):
    """
    Write a temporary file to disk and return the filename.

    :param aclobj:
        An`~acl.ACL` object.

    :param suffix:
        A suffix to use for the temp files.
    """
    tmpfile = tempfile.mktemp() + suffix
    with open(tmpfile, 'w') as f:
        for x in aclobj.output(aclobj.format, replace=True):
            f.write(x + '\n')
    return tmpfile