'create a file in tmp with name and contents'

@staticmethod
def create_tmp_file_from_contents(rname, data, ftype='yaml'):

    tmp = Utils.create_tmpfile(prefix=rname)
    if (ftype == 'yaml'):
        if hasattr(yaml, 'RoundTripDumper'):
            Utils._write(tmp, yaml.dump(data, Dumper=yaml.RoundTripDumper))
        else:
            Utils._write(tmp, yaml.safe_dump(data, default_flow_style=False))
    elif (ftype == 'json'):
        Utils._write(tmp, json.dumps(data))
    else:
        Utils._write(tmp, data)
    atexit.register(Utils.cleanup, [tmp])
    return tmp
