docs: def simulate(self, partition, outdir, jobhandler=default_jobhandler, batchsize=1, **kwargs):
          """
          Simulate a set of alignments from the parameters inferred on a partition
          :param partition:
          :return:
          """
  
          results = self.get_partition_results(partition)
          DEFAULT_DNA_MODEL = 'GTR'
          DEFAULT_PROTEIN_MODEL = 'LG08'
  
          # Collect argument list
          args = [None] * len(self.collection)
  
          for result in results:
              if len(result['partitions']) > 1:
                  places = dict((j,i) for (i,j) in enumerate(rec.name for rec in self.collection.records))
                  for partition in result['partitions'].values():
                      place = places[partition['name']]
                      model = partition.get('model')
                      freqs = partition.get('frequencies')
                      rates = partition.get('rates')
                      alpha = partition.get('alpha')
                      tree  = str(result['ml_tree'])
                      if model is None:
                          model = DEFAULT_DNA_MODEL if self.collection[place].is_dna() else DEFAULT_PROTEIN_MODEL
                      if freqs is not None:
                          freqs = smooth_freqs(freqs)
                      args[place] = (len(self.collection[place]),
                                     model_translate(model),
                                     freqs,
                                     alpha,
                                     tree,
                                     rates)
              else:
                  model = result['partitions']['0'].get('model')
                  freqs = result['partitions']['0'].get('frequencies')
                  rates = result['partitions']['0'].get('rates')
                  alpha = result['partitions']['0'].get('alpha')
                  tree  = str(result['ml_tree'])
                  if freqs is not None:
                      freqs = smooth_freqs(freqs)
                  use_default_model = (model is None)
                  for i in range(len(self.collection)):
                      if use_default_model:
                          model = DEFAULT_DNA_MODEL if self.collection[i].is_dna() else DEFAULT_PROTEIN_MODEL
                      args[i] = (len(self.collection[i]),
                                 model_translate(model),
                                 freqs,
                                 alpha,
                                 tree,
                                 rates)
  
          # Distribute work
          msg = 'Simulating'
          map_result = jobhandler(tasks.simulate_task, args, msg, batchsize)
  
          # Process results
          for i, result in enumerate(map_result):
              orig = self.collection[i]
              simseqs = gapmask(result.items(), orig.get_sequences())
              al = Alignment(simseqs, alphabet=('protein' if orig.is_protein() else 'dna'))
              outfile = os.path.join(outdir, orig.name + '.phy')
              al.write_alignment(outfile, 'phylip', True)