def get_datasets_iter(
        self, shared: Optional[bool] = False
    ) -> Iterator[DatasetData]:
        """Returns an iterator over all datasets owned by the current user.

        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 returned.

        Args:
            shared:
                * If False (default), returns only datasets owned by the user. In this
                case at most one dataset will be returned.
                * If True, returns datasets which have been shared with the user,
                including team datasets. Excludes user's own datasets. Can return
                multiple datasets.
                * If None, returns all datasets the users has access to. Can return
                multiple datasets.

        Returns:
            An iterator over datasets owned by the current user.
        """
        dataset_iterable: Iterator[DatasetData] = (_ for _ in ())
        if not shared or shared is None:
            dataset_iterable = utils.paginate_endpoint(
                self._datasets_api.get_datasets,
                shared=False,
            )
        if shared or shared is None:
            dataset_iterable = chain(
                dataset_iterable,
                utils.paginate_endpoint(
                    self._datasets_api.get_datasets,
                    shared=True,
                ),
            )
            dataset_iterable = chain(
                dataset_iterable,
                utils.paginate_endpoint(
                    self._datasets_api.get_datasets,
                    get_assets_of_team=True,
                ),
            )

        # De-duplicate datasets because results from shared=True and
        # those from get_assets_of_team=True might overlap
        dataset_ids: Set[str] = set()
        for dataset in dataset_iterable:
            if dataset.id not in dataset_ids:
                dataset_ids.add(dataset.id)
                yield dataset
Returns an iterator over all datasets owned by the current user.

        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 returned.

        Args:
            shared:
                * If False (default), returns only datasets owned by the user. In this
                case at most one dataset will be returned.
                * If True, returns datasets which have been shared with the user,
                including team datasets. Excludes user's own datasets. Can return
                multiple datasets.
                * If None, returns all datasets the users has access to. Can return
                multiple datasets.

        Returns:
            An iterator over datasets owned by the current user.
        
lightly/api/api_workflow_datasets.py