def intranges_from_list(list_):
 sorted_list = sorted(list_)
 ranges = []
 last_write = (-1)
 for i in range(len(sorted_list)):
  if ((i + 1) < len(sorted_list)):
   if (sorted_list[i] == (sorted_list[(i + 1)] - 1)):
    continue
  current_range = sorted_list[(last_write + 1):(i + 1)]
  range_tuple = (current_range[0], (current_range[(-1)] + 1))
  ranges.append(range_tuple)
  last_write = i
 return tuple(ranges)

def intranges_from_list ( list_ ) : sorted_list = sorted ( list_ ) ranges = [ ] last_write = ( - 1 ) for i in range ( len ( sorted_list ) ) : if ( ( i + 1 ) < len ( sorted_list ) ) : if ( sorted_list [ i ] == ( sorted_list [ ( i + 1 ) ] - 1 ) ) : continue current_range = sorted_list [ ( last_write + 1 ) : ( i + 1 ) ] range_tuple = ( current_range [ 0 ] , ( current_range [ ( - 1 ) ] + 1 ) ) ranges . append ( range_tuple ) last_write = i return tuple ( ranges )
represent a list of integers as a sequence of ranges: ( .