def increment_filename(filename):
    dirname = os.path.dirname(filename)
    root, ext = os.path.splitext(os.path.basename(filename))

    result = None

    try:
        root_start, root_number_end = rx_numbered.match(root).groups()
    except __HOLE__:
        pass
    else:
        result = "%s%s" % (root_start, str(int(root_number_end) + 1))

    if not result:
        root_start, root_end = root[:-1], root[-1]

        if root_end in ("z", "Z"):
            root_end = "%sa" % root_end
        else:
            root_end = chr(ord(root_end) + 1)

        result = "%s%s" % (root_start, root_end)

    return "%(dirname)s%(sep)s%(root)s%(ext)s" % {
        'dirname': dirname,
        'sep': dirname and "/" or "",
        'root': result,
        'ext': ext
    }
dataset/ETHPy150Open Starou/SimpleIDML/src/simple_idml/utils.py/increment_filename