def saveThing(self,thing,fname,overwrite=True,ext="<STR_LIT>"):
if not os.path.exists(os.path.dirname(self.outpre)):<EOL><INDENT>os.mkdir(os.path.dirname(self.outpre))<EOL><DEDENT>if ext and not ext in fname:<EOL><INDENT>fname+=ext<EOL><DEDENT>fname=self.outpre+fname<EOL>if overwrite is False:<EOL><INDENT>if os.path.exists(fname):<EOL><INDENT>print("<STR_LIT>"%os.path.basename(fname))<EOL>return<EOL><DEDENT><DEDENT>time1=cm.timethis()<EOL>pickle.dump(thing, open(fname,"<STR_LIT:wb>"),pickle.HIGHEST_PROTOCOL)<EOL>print("<STR_LIT>"%(os.path.basename(fname),str(type(thing)),<EOL>sys.getsizeof(pickle.dumps(thing, -<NUM_LIT:1>))/<NUM_LIT>,<EOL>cm.timethis(time1)))<EOL>
save any object as /swhlab4/ID_[fname].pkl