'Creates a temporary file and writes content to it according to a
content creation function. The file object is appended to *args, which
is then passed to the content creation function
:param func: Function that will be used to write content to the
temporary file.
:param *args: List of parameters that func takes.
:return: Path to the temporary file that was created.'

def _create_aux_file(self, func, *args):

    (fd, path) = tempfile.mkstemp(dir=self.host.job.tmpdir)
    aux_file = os.fdopen(fd, 'w')
    try:
        list_args = list(args)
        list_args.append(aux_file)
        func(*list_args)
    finally:
        aux_file.close()
    return path
