import tempfile


def create_tmp_file_handler(content=None, delete=False):
    """
    Create a temp named file.
    """
    if content is None:
        content = ""
    tmp_file = tempfile.NamedTemporaryFile(mode="w+", delete=delete)
    tmp_file.write(content)
    tmp_file.seek(0)
    return tmp_file