def increment_name(self, name, i):
        """
        takes something like
            test.txt
        and returns
            test1.txt
        """
        if i == 0:
            return name
        if '.' in name:
            split = name.split('.')
            split[-2] = split[-2] + str(i)
            return '.'.join(split)
        else:
            return name + str(i)
def increment_name ( self , name , i ) : if i == 0 : return name if '.' in name : split = name . split ( '.' ) split [ - 2 ] = split [ - 2 ] + str ( i ) return '.' . join ( split ) else : return name + str ( i )
takes something like
            test.txt
        and returns
            test1.txt