<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def saveTM(tm):
 """ Saves the temporal memory and the sequences generated for its training. @param tm (TemporalMemory) temporal memory used during the experiment """

  # Save the TM to a file for future use
  proto1 = TemporalMemoryProto_capnp.TemporalMemoryProto.new_message()
  tm.write(proto1)
  # Write the proto to a file and read it back into a new proto
  with open('tm.nta', 'wb') as f:
    proto1.write(f)