from typing import Tuple


def _calculate_splits(number_elements: int, ratio_split: float) -> Tuple[int, int]:
    """Calculates the size of the partitions when splitting a number of elements into two.

    :param number_elements: the total number of elements to split.
    :param ratio_split: a number between 0 and 1 determining linearly how many elements belong in the first set e.g.
                        0.6 would try and place 60% approximately of elements into the first partition.
    :returns: the number of elements in the first and second splits respectively, which are guaranteed to sum to
              :code:number_elements:.
    :throws ValueError: if either split set has zero items.
    """
    number_first = round(number_elements * ratio_split)
    number_second = number_elements - number_first

    if number_first == 0 or number_second == 0:
        raise ValueError(
            f"Each dataset must have at least one item. They had respectively {number_first} and {number_second} items."
        )

    return number_first, number_second