(my_list, complete_list)
Yields a 2-tuple with ranges within a list.

    Args:
        my_list (list): The list that contains potential ranges.
        complete_list (list): The list that contains all potential
            values for comparison.

    Yields:
        Tuple[int, int]: A 2-tuple with the start and end of the range.
Yields a 2-tuple with ranges within a list.
Yields a 2 - tuple with ranges within a list .
def get_range(my_list, complete_list):
    """Yields a 2-tuple with ranges within a list.

    Args:
        my_list (list): The list that contains potential ranges.
        complete_list (list): The list that contains all potential
            values for comparison.

    Yields:
        Tuple[int, int]: A 2-tuple with the start and end of the range.
    """
    list_length = len(my_list)
    cur_first = my_list[0]

    for index in range(0, list_length):
        cur_item = my_list[index]
        try:
            cur_index = complete_list.index(cur_item)
        except ValueError:
            logger.error(
                'Value in list does not exist in the complete list, and '
                'therefore unable to extract a range.')
            return
        if index == list_length -1:
            yield (cur_first, cur_item)
            continue

        if my_list[index + 1] != complete_list[cur_index + 1]:
            yield (cur_first, cur_item)
            cur_first = my_list[index + 1]
def get_range ( my_list , complete_list ) : list_length = len ( my_list ) cur_first = my_list [ 0 ] for index in range ( 0 , list_length ) : cur_item = my_list [ index ] try : cur_index = complete_list . index ( cur_item ) except ValueError : logger . error ( 'Value in list does not exist in the complete list, and ' 'therefore unable to extract a range.' ) return if index == list_length - 1 : yield ( cur_first , cur_item ) continue if my_list [ index + 1 ] != complete_list [ cur_index + 1 ] : yield ( cur_first , cur_item ) cur_first = my_list [ index + 1 ]