code: def getExistingFile(name, max_suffix=1000):
      
      num = 1
      stem, ext = os.path.splitext(name)
      filename = name
      while not os.path.exists(filename):
          suffix = "-%d" % num
          filename = stem + suffix + ext
          num += 1
          if num >= max_suffix:
              raise ValueError("No file %r found" % name)
      return filename
docs: Add filename suffix until file exists
      @return: filename if file is found
      @raise: ValueError if maximum suffix number is reached while searching