code: def domagicmag(file, Recs):
      
      for rec in Recs:
          type = ".0"
          meths = []
          tmp = rec["magic_method_codes"].split(':')
          for meth in tmp:
              meths.append(meth.strip())
          if 'LT-T-I' in meths:
              type = ".1"
          if 'LT-PTRM-I' in meths:
              type = ".2"
          if 'LT-PTRM-MD' in meths:
              type = ".3"
          treatment = float(rec["treatment_temp"]) - 273
          tr = '%i' % (treatment) + type
          inten = '%8.7e ' % (float(rec["measurement_magn_moment"]) * 1e3)
          outstring = rec["er_specimen_name"] + " " + tr + " " + rec["measurement_csd"] + \
              " " + inten + " " + rec["measurement_dec"] + \
              " " + rec["measurement_inc"] + "\n"
          file.write(outstring)
docs: converts a magic record back into the SIO mag format