nodes: 0, module; 1, function_definition; 2, function_name:rangify; 3, parameters; 4, block; 5, identifier:number_list; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, return_statement; 13, comment:"""Assumes the list is sorted."""; 14, not_operator; 15, block; 16, assignment; 17, assignment; 18, identifier:num; 19, subscript; 20, block; 21, call; 22, identifier:ranges; 23, identifier:number_list; 24, return_statement; 25, identifier:ranges; 26, list; 27, identifier:range_start; 28, assignment; 29, identifier:number_list; 30, slice; 31, if_statement; 32, expression_statement; 33, attribute; 34, argument_list; 35, identifier:number_list; 36, identifier:prev_num; 37, subscript; 38, integer:1; 39, comparison_operator:num != (prev_num + 1); 40, block; 41, assignment; 42, identifier:ranges; 43, identifier:append; 44, tuple; 45, identifier:number_list; 46, integer:0; 47, identifier:num; 48, parenthesized_expression; 49, expression_statement; 50, expression_statement; 51, identifier:prev_num; 52, identifier:num; 53, identifier:range_start; 54, identifier:prev_num; 55, binary_operator:prev_num + 1; 56, call; 57, assignment; 58, identifier:prev_num; 59, integer:1; 60, attribute; 61, argument_list; 62, identifier:range_start; 63, identifier:num; 64, identifier:ranges; 65, identifier:append; 66, tuple; 67, identifier:range_start; 68, identifier:prev_num
code: def rangify(number_list):
      """Assumes the list is sorted."""
      if not number_list:
          return number_list
  
      ranges = []
  
      range_start = prev_num = number_list[0]
      for num in number_list[1:]:
          if num != (prev_num + 1):
              ranges.append((range_start, prev_num))
              range_start = num
          prev_num = num
  
      ranges.append((range_start, prev_num))
      return ranges