def _simple_write(filename, obj, fmt=None):
    """Write str(obj) to a file. If fmt is given, format the string first."""
    string = str(obj) if fmt is None else ('{' + fmt + '}').format(obj)
    with open(filename, 'w+') as file:
        file.write(string)
