code: def save(self, obj, label, format='text'):
          
  
          # initialize hidden state directory
  
          objloc = '{0}/{1}'.format(self.statedir, label)
  
          with open(objloc, 'w') as fp:
              if format == 'pickle':
                  pickle.dump(obj, fp)
              elif format == 'text':
                  fp.write(str(obj))
              else:
                  print('Format {0} not recognized. Please choose either pickle or text.'.format(format))
  
          print('Saving {0} to label {1}'.format(obj, label))
docs: Save or update obj as pkl file with name label 
  
          format can be 'text' or 'pickle'.