code: def get_source(
      dataset: Union[DatasetEntity, DatasetInput, Dataset]
  ) -> DatasetSource:
      """Obtains the source of the specified dataset or dataset input.
  
      Args:
          dataset:
              An instance of :py:class:`mlflow.data.dataset.Dataset <mlflow.data.dataset.Dataset>`,
              :py:class:`mlflow.entities.Dataset`, or :py:class:`mlflow.entities.DatasetInput`.
  
      Returns:
          An instance of :py:class:`DatasetSource <mlflow.data.dataset_source.DatasetSource>`.
  
      """
      if isinstance(dataset, DatasetInput):
          dataset: DatasetEntity = dataset.dataset
  
      if isinstance(dataset, DatasetEntity):
          dataset_source: DatasetSource = get_dataset_source_from_json(
              source_json=dataset.source,
              source_type=dataset.source_type,
          )
      elif isinstance(dataset, Dataset):
          dataset_source: DatasetSource = dataset.source
      else:
          raise MlflowException(
              f"Unrecognized dataset type {type(dataset)}. Expected one of: "
              f"`mlflow.data.dataset.Dataset`,"
              f" `mlflow.entities.Dataset`, `mlflow.entities.DatasetInput`.",
              INVALID_PARAMETER_VALUE,
          )
  
      return dataset_source
  
file_path: mlflow/mlflow/data/__init__.py
imports: import sys
  from typing import Union
  from mlflow.data import dataset_registry
  from mlflow.data import sources
  from mlflow.data.dataset import Dataset
  from mlflow.data.dataset_source import DatasetSource
  from mlflow.data.dataset_source_registry import get_dataset_source_from_json, get_registered_sources
  from mlflow.entities import Dataset
  from mlflow.entities import DatasetInput
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
  from mlflow.utils.annotations import experimental
label_desc: Use image node_id 1 for calling a global function with example usage: get_source(dataset) and returns: dataset_source