def _validate_dataset_name(name, skip=None):
    """Validates that the given dataset name is available.

    Args:
        name: a dataset name
        skip (None): an optional :class:`Dataset` to ignore

    Returns:
        the slug

    Raises:
        ValueError: if the name is not available
    """
    slug = fou.to_slug(name)

    query = {"$or": [{"name": name}, {"slug": slug}]}
    if skip is not None:
        query = {"$and": [query, {"_id": {"$ne": skip._doc.id}}]}

    conn = foo.get_db_conn()

    clashing_name_doc = conn.datasets.find_one(
        query, {"name": True, "_id": False}
    )
    if clashing_name_doc is not None:
        clashing_name = clashing_name_doc["name"]
        if clashing_name == name:
            raise ValueError(f"Dataset name '{name}' is not available")
        else:
            raise ValueError(
                f"Dataset name '{name}' is not available: slug '{slug}' "
                f"in use by dataset '{clashing_name}'"
            )

    return slug
Validates that the given dataset name is available.

    Args:
        name: a dataset name
        skip (None): an optional :class:`Dataset` to ignore

    Returns:
        the slug

    Raises:
        ValueError: if the name is not available
    
fiftyone/core/dataset.py