code: def get_unique_filepath(stem):
      
      fp = stem
      if os.path.exists(stem):
          n = 1
          fp = stem + str(n)
          while os.path.exists(fp):
              n += 1
              fp = stem + str(n)
      return fp
docs: NOT thread-safe!
      return stems or stem# where # is the smallest
      positive integer for which the path does not exist.
      useful for temp dirs where the client code wants an
      obvious ordering.