docs: def read_magic_file(self, path, sort_by_this_name, sort_by_file_type=False):
          """
          read a magic-formatted tab-delimited file.
          return a dictionary of dictionaries, with this format:
          {'Z35.5a': {'specimen_weight': '1.000e-03', 'er_citation_names': 'This study', 'specimen_volume': '', 'er_location_name': '', 'er_site_name': 'Z35.', 'er_sample_name': 'Z35.5', 'specimen_class': '', 'er_specimen_name': 'Z35.5a', 'specimen_lithology': '', 'specimen_type': ''}, ....}
          """
          DATA = {}
          with open(path, 'r') as fin:
              lines = list(fin.readlines())
          first_line = lines[0]
          if not first_line:
              return False, None, 'empty_file'
          if first_line[0] == "s" or first_line[1] == "s":
              delim = ' '
          elif first_line[0] == "t" or first_line[1] == "t":
              delim = '\t'
          else:
              print('-W- error reading ', path)
              return False, None, 'bad_file'
  
          file_type = first_line.strip('\n').split(delim)[1]
          if sort_by_file_type:
              item_type = file_type.split('_')[1][:-1]
              if item_type == 'age':
                  sort_by_this_name = "by_line_number"
              else:
                  sort_by_this_name = 'er_' + item_type + '_name'
          line = lines[1]
          header = line.strip('\n').split(delim)
          counter = 0
          for line in lines[2:]:
              tmp_data = {}
              tmp_line = line.strip('\n').split(delim)
              for i in range(len(header)):
                  if i < len(tmp_line):
                      tmp_data[header[i]] = tmp_line[i].strip()
                  else:
                      tmp_data[header[i]] = ""
              if sort_by_this_name == "by_line_number":
                  DATA[counter] = tmp_data
                  counter += 1
              else:
                  if tmp_data[sort_by_this_name] != "":
                      DATA[tmp_data[sort_by_this_name]] = tmp_data
          return DATA, header, file_type