code: def writeSampleIndex(self, fp):
          print('\n'.join(
              '%d %s' % (index, name) for (index, name) in
              sorted((index, name) for (name, index) in self._samples.items())
          ), file=fp)