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)
Saves the temporal memory and the sequences generated for its training.
  
  @param tm (TemporalMemory) temporal memory used during the experiment