import tempfile


def save_file(data):
    """Save data to a temporary file and return its name."""
    tmp_dir = tempfile.gettempdir()

    with tempfile.NamedTemporaryFile(
        prefix='plumber-',
        dir=tmp_dir,
        delete=False
    ) as f:
        f.write(data)
        f.flush()
        return f.name