def str_to_file(str_val, fname, mode='w'):
    """
    Writes the string to the given file.
    @param str_val: The string to write.
    @param fname: The location of the file to write
    @param mode: default mode is to overwrite file
    @return:
    """
    with open(fname, mode) as f:
        f.write(str_val)
