code: def _get_batch_name(items, skip_jointcheck=False):
      
      batch_names = collections.defaultdict(int)
      has_joint = any([is_joint(d) for d in items])
      for data in items:
          if has_joint and not skip_jointcheck:
              batches = dd.get_sample_name(data)
          else:
              batches = dd.get_batches(data) or dd.get_sample_name(data)
          if not isinstance(batches, (list, tuple)):
              batches = [batches]
          for b in batches:
              batch_names[b] += 1
      return sorted(batch_names.items(), key=lambda x: x[-1], reverse=True)[0][0]
docs: Retrieve the shared batch name for a group of items.