def check_single_table_dataset(dataset, expected_table=None):
    """
    Raise if the given dataset is not a single-table dataset.

    Parameters
    ----------
    dataset: kartothek.core.dataset.DatasetMetadata
        The dataset to be validated
    expected_table: Optional[str]
        Ensure that the table in the dataset is the same as the given one.
    """
    if len(dataset.tables) > 1:
        raise TypeError(
            'Expected single table dataset but found dataset with tables: `{}`'
            .format(dataset.tables))
    if expected_table and dataset.tables != [expected_table]:
        raise TypeError(
            'Unexpected table in dataset:\nFound:\t{}\nExpected:\t{}'.
            format(dataset.tables, expected_table))
