Create a temporary file for the duration of this context manager,
    deleting it afterwards.

    Yields:
        str - path to the file

def temp_file():
    """Create a temporary file for the duration of this context manager,
    deleting it afterwards.

    Yields:
        str - path to the file
    """
    fd, path = tempfile.mkstemp()
    os.close(fd)
    try:
        yield path
    finally:
        os.remove(path)