def _merge_batch_class(existing, other):
    """
    Sets or unions two sets, for building batch class restrictions.
    If existing is None, the other set is returned directly

    Parameters:
        existing: iterable object of the current batch classes
        other: iterable object of batch classes to add

    Returns:
        (set): union of existing and other
    """
    if existing is None:
        return set(other)
    else:
        return set(existing).union(set(other))