def split_dataset(dataset, splits={'train': 0.7,
                                   'test': 0.15,
                                   'valid': 0.15}):
    """Split a tensorflow dataset into n subsets.

    :param dataset: dataset to be split up
    :type dataset: tf.data.Dataset
    :param splits: specifies the proportion for each subset, defaults to:
        'train' => 70%
        'test' => 15%
        'valid' => 15%
    :type splits: dictonary, values of type float which sum up to max 1,
        optional
    :return: new smaller datasets
    :rtype: dictonary, keys are the same as in the splits-argument and the
        values are tf.data.Dataset's
    """
    assert sum(splits.values()) <= 1, "split-proportions sum to more than 1!"
    datasets = {}
    batch_number = len(list(dataset))
    # iterate through splits to create dataset-subsets
    take = 0
    for i, (key, proportion) in enumerate(splits.items()):
        if i == 0:
            take = int(batch_number * proportion)
            datasets[key] = dataset.take(take)
        else:
            datasets[key] = dataset.skip(take)
            datasets[key] = datasets[key].take(int(batch_number * proportion))
            take += int(batch_number * proportion)
    return datasets