def _coalesce_version_id(*args):
    """Helper to coalesce a list of version_ids down to one"""
    version_ids = set(args)
    if None in version_ids:
        version_ids.remove(None)
    if len(version_ids) > 1:
        raise ValueError(
            'Cannot coalesce version_ids where more than one are defined, {}'
            .format(version_ids))
    elif len(version_ids) == 0:
        return None
    else:
        return version_ids.pop()
