code: def _makeUniqueFilename(taken_names, name):
      
      if name in taken_names:
          # try to form up new name
          basename, ext = os.path.splitext(name)
          num = 1
          name = "%s-%d%s" % (basename, num, ext)
          while name in taken_names:
              num += 1
              name = "%s-%d%s" % (basename, num, ext)
      # finally, enter name into set
      taken_names.add(name)
      return name
docs: Helper function. Checks if name is in the set 'taken_names'.
      If so, attepts to form up an untaken name (by adding numbered suffixes).
      Adds name to taken_names.