<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_batch_name(items, skip_jointcheck=False):
 """Retrieve the shared batch name for a group of items. """

    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]