code: def group_batches(xs):
      
      def _caller_batches(data):
          caller = tz.get_in(("config", "algorithm", "variantcaller"), data)
          jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), data)
          batch = tz.get_in(("metadata", "batch"), data) if not jointcaller else None
          return caller, batch
      def _prep_data(data, items):
          data["region_bams"] = [x["region_bams"] for x in items]
          return data
      return _group_batches_shared(xs, _caller_batches, _prep_data)
docs: Group samples into batches for simultaneous variant calling.
  
      Identify all samples to call together: those in the same batch
      and variant caller.
      Pull together all BAM files from this batch and process together,
      Provide details to pull these finalized files back into individual
      expected files.
      Only batches files if joint calling not specified.