def new_filename(fname=None, ndigits=3):
    if fname is None:
        ext = ("%%.%ii" % ndigits) % 1
        fname = "%s.%s" % (random_string(6), ext)

    if os.path.exists(fname):
        fname = increment_filename(fname, ndigits=ndigits)

    return fname
generate a new file name, either based on
dataset/ETHPy150Open xraypy/xraylarch/plugins/io/fileutils.py/new_filename