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