def dataset_name_exists(
        self, dataset_name: str, shared: Optional[bool] = False
    ) -> bool:
        """Checks if a dataset with the given name exists.

        There can be multiple datasets with the same name accessible to the current
        user. This can happen if either:
        * A dataset has been explicitly shared with the user
        * The user has access to team datasets
        The `shared` flag controls whether these datasets are checked.

        Args:
            dataset_name:
                Name of the dataset.
            shared:
                * If False (default), checks only datasets owned by the user.
                * If True, checks datasets which have been shared with the user,
                including team datasets. Excludes user's own datasets.
                * If None, checks all datasets the users has access to.

        Returns:
            A boolean value indicating whether any dataset with the given name exists.

        Examples:
            >>> client = ApiWorkflowClient(token="MY_AWESOME_TOKEN")
            >>> client.create_dataset("your-dataset-name", dataset_type=DatasetType.IMAGES)
            >>> client.dataset_name_exists(dataset_name="your-dataset-name")
            True
        """
        return bool(self.get_datasets_by_name(dataset_name=dataset_name, shared=shared))
Checks if a dataset with the given name exists.

        There can be multiple datasets with the same name accessible to the current
        user. This can happen if either:
        * A dataset has been explicitly shared with the user
        * The user has access to team datasets
        The `shared` flag controls whether these datasets are checked.

        Args:
            dataset_name:
                Name of the dataset.
            shared:
                * If False (default), checks only datasets owned by the user.
                * If True, checks datasets which have been shared with the user,
                including team datasets. Excludes user's own datasets.
                * If None, checks all datasets the users has access to.

        Returns:
            A boolean value indicating whether any dataset with the given name exists.

        Examples:
            >>> client = ApiWorkflowClient(token="MY_AWESOME_TOKEN")
            >>> client.create_dataset("your-dataset-name", dataset_type=DatasetType.IMAGES)
            >>> client.dataset_name_exists(dataset_name="your-dataset-name")
            True
        
lightly/api/api_workflow_datasets.py