code: def parse_project_and_dataset(
      project: str, dataset: Optional[str] = None
  ) -> Tuple[str, str, Optional[str]]:
      
      try:
          data_project, dataset = dataset.split('.')
      except (ValueError, AttributeError):
          billing_project = data_project = project
      else:
          billing_project = project
  
      return data_project, billing_project, dataset
docs: Compute the billing project, data project, and dataset if available.
  
      This function figure out the project id under which queries will run versus
      the project of where the data live as well as what dataset to use.
  
      Parameters
      ----------
      project : str
          A project name
      dataset : Optional[str]
          A ``<project>.<dataset>`` string or just a dataset name
  
      Examples
      --------
      >>> data_project, billing_project, dataset = parse_project_and_dataset(
      ...     'ibis-gbq',
      ...     'foo-bar.my_dataset'
      ... )
      >>> data_project
      'foo-bar'
      >>> billing_project
      'ibis-gbq'
      >>> dataset
      'my_dataset'
      >>> data_project, billing_project, dataset = parse_project_and_dataset(
      ...     'ibis-gbq',
      ...     'my_dataset'
      ... )
      >>> data_project
      'ibis-gbq'
      >>> billing_project
      'ibis-gbq'
      >>> dataset
      'my_dataset'
      >>> data_project, billing_project, dataset = parse_project_and_dataset(
      ...     'ibis-gbq'
      ... )
      >>> data_project
      'ibis-gbq'
      >>> print(dataset)
      None