<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_string(cls, dataset_id, default_project=None):
 """Construct a dataset reference from dataset ID string. Args: dataset_id (str):
 A dataset ID in standard SQL format. If ``default_project`` is not specified, this must included both the project ID and the dataset ID, separated by ``.``. default_project (str):
 Optional. The project ID to use when ``dataset_id`` does not include a project ID. Returns: DatasetReference: Dataset reference parsed from ``dataset_id``. Examples: DatasetReference('my-project-id', 'some_dataset') Raises: ValueError: If ``dataset_id`` is not a fully-qualified dataset ID in standard SQL format. """

        output_dataset_id = dataset_id
        output_project_id = default_project
        parts = dataset_id.split(".")

        if len(parts) == 1 and not default_project:
            raise ValueError(
                "When default_project is not set, dataset_id must be a "
                "fully-qualified dataset ID in standard SQL format. "
                'e.g. "project.dataset_id", got {}'.format(dataset_id)
            )
        elif len(parts) == 2:
            output_project_id, output_dataset_id = parts
        elif len(parts) > 2:
            raise ValueError(
                "Too many parts in dataset_id. Expected a fully-qualified "
                "dataset ID in standard SQL format. e.g. "
                '"project.dataset_id", got {}'.format(dataset_id)
            )

        return cls(output_project_id, output_dataset_id)