from typing import Any
import tempfile


def _write_temp_file(data: Any) -> tempfile._TemporaryFileWrapper:  # type: ignore
    """
    Writes a named temporary file with the given data.

    Returns:
        [TemporaryFileWrapper] -- a file handle to the created temp file
    """
    tmp = tempfile.NamedTemporaryFile(delete=False)
    tmp.write(data)
    tmp.close()
    return tmp