from typing import Tuple
from typing import List
from typing import Union


def _read_range(range: str) -> Tuple[str, List[Tuple[Union[int, None], Union[int, None]]]]:
    """Parses a range string.\n
    Separates the string into the unit, and the range pairs.\n
    A None value in the pair range specifies that the value was not given, this is expected behaviour.
    :returns:Tuple[str,List[Tuple[Union[int,None],Union[int,None]]]]"""
    format, split_on_pairs = range.split('=', 1)
    split_on_pairs = split_on_pairs.split(',')
    pairs = []
    for pair_str in split_on_pairs:
        split_on_range = pair_str.split('-', 1)
        start = int(split_on_range[0]) if len(split_on_range[0]) > 0 else None
        stop = int(split_on_range[1]) if len(split_on_range[1]) > 0 else None
        pairs.append((start, stop))
    return format, pairs