docstr: Creates a new dataset on the Lightly Platform.
  
  If a dataset with the specified name already exists,
  the name is suffixed by a counter value.
  
  Args:
      dataset_basename:
          The name of the dataset to be created.
      dataset_type:
          The type of the dataset. We recommend to use the API provided
          constants `DatasetType.IMAGES` and `DatasetType.VIDEOS`.
  
  Examples:
      >>> client = ApiWorkflowClient(token="MY_AWESOME_TOKEN")
      >>>
      >>> # Create a dataset with a brand new name.
      >>> client.create_new_dataset_with_unique_name("new-dataset")
      >>> client.get_dataset_by_id(client.dataset_id)
      {'id': '6470abef4f0eb7e635c30954',
       'name': 'new-dataset',
       ...}
      >>>
      >>> # Create another dataset with the same name. This time, the
      >>> # new dataset should have a suffix `_1`.
      >>> client.create_new_dataset_with_unique_name("new-dataset")
      >>> client.get_dataset_by_id(client.dataset_id)
      {'id': '6470ac194f0eb7e635c30990',
       'name': 'new-dataset_1',
       ...}
docstr_tok: ["Creates","a","new","dataset","on","the","Lightly","Platform",".","If","a","dataset","with","the","specified","name","already","exists",",","the","name","is","suffixed","by","a","counter","value",".","Args",":","dataset_basename",":","The","name","of","the","dataset","to","be","created",".","dataset_type",":","The","type","of","the","dataset",".","We","recommend","to","use","the","API","provided","constants","`","DatasetType.IMAGES","`","and","`","DatasetType.VIDEOS","`",".","Examples",":",">",">",">","client","=","ApiWorkflowClient","(","token=","''","MY_AWESOME_TOKEN","''",")",">",">",">",">",">",">","#","Create","a","dataset","with","a","brand","new","name",".",">",">",">","client.create_new_dataset_with_unique_name","(","``","new-dataset","''",")",">",">",">","client.get_dataset_by_id","(","client.dataset_id",")","{","'id","'",":","'6470abef4f0eb7e635c30954","'",",","'name","'",":","'new-dataset","'",",","...","}",">",">",">",">",">",">","#","Create","another","dataset","with","the","same","name",".","This","time",",","the",">",">",">","#","new","dataset","should","have","a","suffix","`","_1","`",".",">",">",">","client.create_new_dataset_with_unique_name","(","``","new-dataset","''",")",">",">",">","client.get_dataset_by_id","(","client.dataset_id",")","{","'id","'",":","'6470ac194f0eb7e635c30990","'",",","'name","'",":","'new-dataset_1","'",",","...","}"]
code: def create_new_dataset_with_unique_name(
      self,
      dataset_basename: str,
      dataset_type: str = DatasetType.IMAGES,
  ) -> None:
      """Creates a new dataset on the Lightly Platform.
  
      If a dataset with the specified name already exists,
      the name is suffixed by a counter value.
  
      Args:
          dataset_basename:
              The name of the dataset to be created.
          dataset_type:
              The type of the dataset. We recommend to use the API provided
              constants `DatasetType.IMAGES` and `DatasetType.VIDEOS`.
  
      Examples:
          >>> client = ApiWorkflowClient(token="MY_AWESOME_TOKEN")
          >>>
          >>> # Create a dataset with a brand new name.
          >>> client.create_new_dataset_with_unique_name("new-dataset")
          >>> client.get_dataset_by_id(client.dataset_id)
          {'id': '6470abef4f0eb7e635c30954',
           'name': 'new-dataset',
           ...}
          >>>
          >>> # Create another dataset with the same name. This time, the
          >>> # new dataset should have a suffix `_1`.
          >>> client.create_new_dataset_with_unique_name("new-dataset")
          >>> client.get_dataset_by_id(client.dataset_id)
          {'id': '6470ac194f0eb7e635c30990',
           'name': 'new-dataset_1',
           ...}
  
      """
      if not self.dataset_name_exists(dataset_name=dataset_basename):
          self._create_dataset_without_check_existing(
              dataset_name=dataset_basename,
              dataset_type=dataset_type,
          )
      else:
          existing_datasets = list(
              utils.paginate_endpoint(
                  self._datasets_api.get_datasets_query_by_name,
                  dataset_name=dataset_basename,
                  exact=False,
                  shared=False,
              )
          )
          existing_dataset_names = {
              dataset.name for dataset in existing_datasets
          }
          counter = 1
          dataset_name = f"{dataset_basename}_{counter}"
          while dataset_name in existing_dataset_names:
              counter += 1
              dataset_name = f"{dataset_basename}_{counter}"
          self._create_dataset_without_check_existing(
              dataset_name=dataset_name,
              dataset_type=dataset_type,
          )
  
imports: import warnings
  from itertools import chain
  from typing import Iterator, List, Optional, Set
  from lightly.api import utils
  from lightly.openapi_generated.swagger_client.models import CreateEntityResponse, DatasetCreateRequest, DatasetData, DatasetType
  from lightly.openapi_generated.swagger_client.rest import ApiException
label_desc: Use image node_id 13 for calling the _DatasetsMixin obj's underlying member method code with example usage: obj.create_new_dataset_with_unique_name(dataset_basename, dataset_type) without return types