code: def tuple_alter(tup, *pairs):
      
      # timeit says that this is faster than a similar
      tuple_list = list(tup)
      for i, f in pairs:
          tuple_list[i] = f(tuple_list[i])
      return tuple(tuple_list)
docs: Return a copy of a tuple with some elements altered.
  
      :param tup: The tuple to be copied.
      :param pairs: Any number of (index, func) tuples where index is the index
          of the item to alter and the new value is func(tup[index]).