import tempfile


def _create_temp_file(contents):
    """Create a temp file.

    :param contents: The temp file contents.
    :return: The absolute path of the created temp file.
    """
    tf = tempfile.NamedTemporaryFile(
        mode='wb', suffix='txt', delete=False)
    tf.write(contents)
    tf.close()
    return tf.name