(hour_list)
return runs
Returns a list of runs from a list of numbers.

    Args:
        hour_list: a list of integers.

    Returns:
        A list of tuples, where each tuple indicates the first
        and last record of a consecutive run of numbers, eg
        list 1, 2, 3, 7, 8, 9 would produce the output
        of (1,3), (7, 9).
Returns a list of runs from a list of numbers.
Returns a list of runs from a list of numbers .
def get_list_of_consecutive_sequences(hour_list):
    """Returns a list of runs from a list of numbers.

    Args:
        hour_list: a list of integers.

    Returns:
        A list of tuples, where each tuple indicates the first
        and last record of a consecutive run of numbers, eg
        list 1, 2, 3, 7, 8, 9 would produce the output
        of (1,3), (7, 9).
    """
    runs = []
    if not hour_list:
        return runs

    start = hour_list[0]
    now = start
    for hour in hour_list[1:]:
        if hour == (now + 1):
            now = hour
            continue

        runs.append((start, now))
        start = hour
        now = start

    if not runs:
        runs = [(hour_list[0], hour_list[-1])]

    last_start, last_end = runs[-1]

    if (start != last_start) and (last_end != now):
        runs.append((start, now))

    return runs
def get_list_of_consecutive_sequences ( hour_list ) : runs = [ ] if not hour_list : return runs start = hour_list [ 0 ] now = start for hour in hour_list [ 1 : ] : if hour == ( now + 1 ) : now = hour continue runs . append ( ( start , now ) ) start = hour now = start if not runs : runs = [ ( hour_list [ 0 ] , hour_list [ - 1 ] ) ] last_start , last_end = runs [ - 1 ] if ( start != last_start ) and ( last_end != now ) : runs . append ( ( start , now ) ) return runs