code: def run(items, run_parallel):
      
      to_process = []
      extras = []
      for batch, cur_items in _group_by_batches(items).items():
          if _ready_for_het_analysis(cur_items):
              to_process.append((batch, cur_items))
          else:
              for data in cur_items:
                  extras.append([data])
      processed = run_parallel("heterogeneity_estimate", ([xs, b, xs[0]["config"]] for b, xs in to_process))
      return _group_by_sample_and_batch(extras + processed)
docs: Top level entry point for calculating heterogeneity, handles organization and job distribution.