def __getitem__(self, x: Union[(int, slice)]) -> T:
    stop = None
    if (type(x) == slice):
        stop = (x.stop or INFINITY)
        x = (x.start or 0)
    if (type(x) != int):
        raise TypeError(f'Expected integer, got {type(x).__name__}.')
    assert (type(x) is int)
    (idx, _) = self._find_index(x)
    if stop:
        (idx2, _) = self._find_index((stop - 1))
        if (idx != idx2):
            raise ValueError('Indexed with slice but value is inconsistent across slice.')
    return self._values[idx][1]
def __getitem__(self, x: Union[(int, slice)]) -> T:
    stop = None
    if (type(x) == slice):
        stop = (x.stop or INFINITY)
        x = (x.start or 0)
    if (type(x) != int):
        raise TypeError(f'Expected integer, got {type(x).__name__}.')
    assert (type(x) is int)
    (idx, _) = self._find_index(x)
    if stop:
        (idx2, _) = self._find_index((stop - 1))
        if (idx != idx2):
            raise ValueError('Indexed with slice but value is inconsistent across slice.')
    return self._values[idx][1]