def doublet_occurrence(iterable, doublet_sum):
    """
    A doublet is said to be present if any of the two numbers in the iterable is equal to given doublet_sum
    :param iterable: Iterable should be either of the types list or tuple of minimum length 2 with numbers
    :param doublet_sum: Doublet sum should be a number
    :return: True if doublet is present, else False

        Eg: doublet_occurrence((-3, 9, 8), 5) gives True
        Here -3 and 8 adds up to give 5 which is the given doublet_sum
    """
    if type(iterable) == list or type(iterable) == tuple:
        pass
    else:
        raise TypeError('Iterable should be of either list or tuple')
    for item in iterable:
        if not isinstance(item, int):
            raise ValueError('Only numbers are accepted in the iterable')
    if not isinstance(doublet_sum, int):
        raise ValueError('Doublet sum should be a number')
    if len(iterable) < 2:
        raise Exception(
            'Length of the given iterable should be of minimum length 2 ')
    iterable = list(iterable)
    iterable.sort()
    low = 0
    high = len(iterable) - 1
    current_sum = iterable[low] + iterable[high]
    while low < high:
        if current_sum == doublet_sum:
            return True
        elif current_sum < doublet_sum:
            low += 1
            current_sum += iterable[low] - iterable[low - 1]
        else:
            high -= 1
            current_sum += iterable[high] - iterable[high + 1]
    return False
